jquery post 请求

code
$.ajax({
     url: "/cal/",
     type: "post",
     data: {
        "n1":$("#num1").val(),
        "n2":$("#num2").val(),
     },
    success:function (data) {
         console.log(data);
         $("#ret").val(data);
    }
})
 
code
$.ajax({
        type:"POST",
        url:"{% url 'addbook' %}",
        contentType:'application/json',
        data:JSON.stringify(msg),
        dataType:'JSON',
        error:function(data) {
            console.log("error");
        },
        success:function(data) {
            console.log("success");
        }
    });

 

 
Add:
 
 
 
 
 
 
 
 
 
 
 
 
 
 

posted @ 2020-12-24 00:08  anobscureretreat  阅读(280)  评论(0编辑  收藏  举报