posted 12 years ago
Hi All,
I am facing Cross Site Script error while making AJAX call using XMLHttpRequest(). I used following code to resolve the issue : http.setRequestHeader("Access-Control-Allow-Origin","*");
Please find the code :
if (window.XMLHttpRequest) { // code for IE7+, FF, Chrome, Opera, Safari
http=new XMLHttpRequest();
}
else { // code for IE6, IE5
http=new ActiveXObject("Microsoft.XMLHTTP");
}
http.open("GET", url, true);
http.setRequestHeader("Access-Control-Allow-Origin","*");
http.send();
Issue : After adding this statement " http.setRequestHeader("Access-Control-Allow-Origin","*");" the AJAX call only is not happening.
I am not getting any error also.
But, not getting why it is not working.
Please help me. If any other way is there to solve Cross Site Script error then also suggest me.
Thanks in advance !!