美文网首页Python
django ajax传递json

django ajax传递json

作者: warmi_ | 来源:发表于2018-11-23 17:20 被阅读21次

    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

        本文链接:https://www.haomeiwen.com/subject/zutsqqtx.html