A. Call using the Jsonp method
For more information, refer to the JQ documentation "JQuery 1.10.3 Online Handbook"
Two. Service-side configuration
modifying web.config files
<system.webServer>
<modules runallmanagedmodulesforallrequests= "true" ></modules>
< httpprotocol>
<customHeaders>
<add name= "Access-control-allow-origin" value= "*"/>
<add name= "Access-control-allow-headers" value= "Content-type"/> <add name=
" Access-control-allow-methods "value=" Get,post,put,delete "/>
</customHeaders>
</ Httpprotocol>
</system.webServer>
The client invokes the code as follows
var param = {};
var msg = "Dafdasfdsaf";
param["userName"] = "1";
param["PassWord"] = "1";
param["code"] = "3323";
$.ajax ({
URL: "http://www.ts-wms.com/UserAjax/Login?t=" + math.random (),
Data:param,
type: "POST",
Async:false,
success:function (result) {
alert (result);
msg = result;
}
});
Alert (msg+ "DDDDDDDDDDFFFFFFFFFFFFFFFF");
Successful test calls can be used on phone-side calls.
The above asp.net with jquery to solve the problem of Cross-domain call is small series to share all the content of everyone, I hope to give you a reference, but also hope that we support the cloud habitat community.