Today, when Ajax requests a domain name, it appears
Cross-origin requests have been blocked: the same-origin policy prohibits reading remote resources located in http://www.zuimeimami.com*****. (Reason: CORS header is missing ' Access-control-allow-origin ').
Workaround 1:
var url= ' http://localhost:8080/WorkGroupManagment/open/getGroupById ' + '? id=1&callback=? '; $.ajax ({ url:url, dataType: ' Jsonp ', processdata:false, type: ' Get ', success:function (data) { alert (data.name) , error:function (XMLHttpRequest, Textstatus, Errorthrown) { alert ( Xmlhttprequest.status); alert (xmlhttprequest.readystate); alert (textstatus); }});
Workaround 2:
var url= "Http://localhost:8080/WorkGroupManagment/open/getGroupById" + "? id=1&callback=?"; $.jsonp ({ "url": URL, "Success": function (data) { $ ("#current-group"). Text ("Current workgroup:" +data.result.name) ; }, "error": function (d,msg) { alert ("Could not find User" +msg);} );
Solution Three:
The requested page with the following code, the best content to fill in the domain name
<meta http-equiv= "Access-control-allow-origin" content= "*" >
Workaround four, in the request controller plus
header(
"Access-Control-Allow-Origin: *"
);
JS Ajax cross-domain blocked CORS header missing ' access-control-allow-origin ' (GO)