Home >Web Front-end >JS Tutorial >js cross-domain request service instance analysis

js cross-domain request service instance analysis

小云云
小云云Original
2018-02-27 14:05:221400browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn