I have a Html file locally with the following code
<h1>This is session token </h1>
<div id="noob"></div>
<script src="http://code.jquery.com/jquery-1.9.1.min.js" type="text/javascript"></script>
<script>
$(document).ready(function(){
var sessiontoken;
var randomUser = Math.round(Math.random() * 1000000);
var supportCors = $.support.cors;
var sessiontoken ;
$.support.cors = true;
$.ajax({
type: 'POST',
url: "https://abc.com/Gateway.Session/Session",
dataType: "json",
data: {
UserId: "TestUser" + randomUser,
CSK1: "abc",
CustId: "cde"
},
success: function (data) {
$.support.cors = supportCors;
sessiontoken=data.Token;
alert(sessiontoken);
document.getElementById('noob').innerHTML = sessiontoken;
},
error: function (xhr, textStatus, error) {
$.support.cors = supportCors;
alert("responseText: " + xhr.responseText);
alert("XHR statusText: " + xhr.statusText);
alert("textStatus: " + textStatus);
alert("error: " + error.message);
}
});
});
</script>
This code when run locally(ex: c:/development/mypage.html) is generating session token after enabling the pop-up 'allow running javascript' " of IE7. i.e., ajax function in above javascript is returning 'success' when run locally and session token is generated. But when this code is deployed in server and opened in IE7 like (http:// localhost:8080/mypage.html), here ajax function of above script is returning 'error'.
As when we run the file locally we enabled the pop-up to allow running script. But when the file is deployed in server we won't get such pop-up as javascript runs itself when a html page is accessed from server. I am unable to figure out why control going to 'error' part o 'success' when we file from server
So how can i make this ajax function to return to 'success' part when accessed from server.
The file executes fine in chrome when accessed locally or from server.Now i need it to be working with IE7.