0
Как отправить объект javascript через jQuery в django?jQuery отправить объект js через ajax в django view
$.ajax({
type: 'POST',
url: '/fetch-items/',
data: {'foo': 'bar', 'foobar': {'spam': 'eggs'} },
success: function(){
alert('yey');
}
});
Джанго часть:
def fetch_items(request):
if request.is_ajax():
print request.POST
#output
>>> <QueryDict: {u'foo': [u'bar'], u'foobar[spam]': [u'eggs']}>
Почему 'Foobar [спам]' ключ и не 'Foobar' ключ к Dict { 'спам': 'яйца'}?
bummer. в любом случае спасибо. – rotrotrot