Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function createCORSRequest(method, url){
- var xhr = new XMLHttpRequest();
- if ("withCredentials" in xhr){
- xhr.open(method, url, true);
- } else if (typeof XDomainRequest != "undefined"){
- xhr = new XDomainRequest();
- xhr.open(method, url);
- } else {
- xhr = null;
- }
- return xhr;
- }
- var request = createCORSRequest("post", "http://xx.xxxx.com/");
- if (request){
- request.onload = function(){
- //do something with request.responseText
- };
- request.send(myPostObjectDataVariableGoeshere);
- }
- SEC7118: XMLHttpRequest for http://xx.xxxx.com/ required Cross Origin Resource Sharing (CORS).
- SEC7120: Origin null not found in Access-Control-Allow-Origin header.
- SCRIPT7002: XMLHttpRequest: Network Error 0x80070005, Access is denied.
- header('Access-Control-Allow-Origin: *');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement