django ajax传递json

You need to use JSON.stringify(arr) while parsing data

$(document).ready(function() {       
    $("#button").click(function() {
          $.ajax({
            url:"http://10.124.92.208:8000/customer/retrieve_info",
            crossDomain:true,
            data: JSON.stringify({"order_clientId" : 114, "order_start_dt" : "2016-01-01T21:25:22", "order_end_dt" : "2016-01-05T21:25:22"}), 
            contentType: 'application/json; charset=utf-8',
            type:"POST",
            dataType:"json",
          })
          .done(function(json){
            alert(json);
          });
    });

});

抄自https://stackoverflow.com/questions/38393523/proper-json-not-received-in-django-request
成功

你可能感兴趣的:(django ajax传递json)