Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

django ajax body to json

// From AJAX you need to post the data as JSON string rather than 
// a JavaScript object.
payload = JSON.stringify({"name": "foo", "username":"bar"})

$.ajax({
  url: 'some url',
  type: "POST",
  // ...
  data: payload,
  dataType: 'json',
  //..
})
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #django #ajax #body #json
ADD COMMENT
Topic
Name
3+4 =