https://cnodejs.org/topic/56ef3edd532839c33a99d00e 前端资源

常用ajax代码

var requestUrl="http://localhost/1.html?callback=?";
$.ajax({
    type : "get",
    async:true,
    url : requestUrl,
    data : "channelid=7&current=1&rowSize=4",
    dataType : "jsonp",
    success :function(data){
        console.log("--------(xxxxx)-----success");
    },
    error:function(data){
        console.log("error: (xxxxx)");
    }
});

//跨域要使用jsonp ,前端和后台都要使用callback, 

posted @ 2016-03-29 15:05  乐淘淘zzxh  阅读(103)  评论(0编辑  收藏  举报