How to send List of objects via ajax to server


#1

Hi,

I am using python&Django REST for backend.

How to send List format to the bakend via ajax

Any sort of help should be appreciable

EMBER

var data_payload = [{"title":"ember", "title":"ember-cli"}]

return ajax({
    url: 'here django server url',
    type: 'post',
    data: JSON.stringify(data_payload)
   }).then(function(output) {
       return output;
   });

DJANGO REST :

I am getting wrong format as below

{u'[{"title":"ember"},{"tile":"ember-cli"}]': u''}

The correct format should be like

[{"title":"ember"},{"tile":"ember-cli"}]

#2

Ugh, your payload object contains two keys with the same name. Is it a mistake or a typo?


#3

Hi, Thanks for your reply !! Sorry, its typo !! Just now problem has been resolved. The problem is with ajax function