jQuery send a Json to Django.view:
$.ajax({
type: 'POST',//Which method you used to send
url:'/CreateAsset/example',//Send this data to Which page to deal
data: result,
dataType: 'json',
success : function(json) {// callback when send successful
//parameter is the name of var
for(i in json){
console.log(json[i])
}
}
})
Django send a json to JQuery (version>1.7):
if request.is_ajax and request.method == 'POST' :
//do something
return HttpResponse(
json.dumps(data),// 'data' is a data you want to send
content_type="application/json" //co-work with ajax-success callback function
)