Home >Web Front-end >JS Tutorial >js cross-domain request service instance analysis
This article mainly shares with you the analysis of js cross-domain request service examples, hoping to help everyone.
function getAreaPosionsSucess(data){ alert("请求成功"); } function requestServerData(){ var url="http://127.0.0.1:8080/railWay/client/getWorkFlowStepAreas.do"; $.ajax(url, { data: { 'id': workFlowId }, dataType: 'jsonp', crossDomain: true, '_': new Date().getTime() , jsonp: "callback", //传递给请求处理程序或页面的,用以获得jsonp回调函数名的参数名(一般默认为:callback) jsonpCallback:"getAreaPosionsSucess",//自定义的jsonp回调函数名称,默认为jQuery自动生成的随机函数名,也可以写"?",jQuery会自动为你处理数据 }); }
Related recommendations:
JS implements Ajax cross-domain request flask response content
How to implement Javascript cross-domain request code detailed explanation
JavaScript uses JSONP to request cross-domain data examples in detail
The above is the detailed content of js cross-domain request service instance analysis. For more information, please follow other related articles on the PHP Chinese website!