使用jsonp處理跨域問題

調用web接口,get請求,發現提示:No 'Access-Control-Allow-Origin' header is present on the requested resource.web

這個和安全機制有關,默認不容許跨域調用ajax

處理手段:使用jsonp格式, ajax請求參數dataType:'JSONP'。json

$.ajax({
        url: "http://.......",
        type: 'GET',
        dataType: 'JSONP',//here
        success: function (data) {

        }
    });
相關文章
相關標籤/搜索