I am having a java service ,which is getting called in javascript using xmlHttpRequest and it is returning XML Data. It's working fine upto IE 8.Now we are trying it in IE 11,chrome and mozilla it is giving 500 (Internal Server Error) .Code is as follows.
request = new XMLHttpRequest();
request.open('POST', SERVERHOSTNAME+"/XXXXXX/XXXXXX/XXXXX/XXXXXInsert");
request.send(req,300000);
After googling I found it is related to cross domain requests and used the following code.
request.setRequestHeader("Access-Control-Allow-Origin", SERVERHOSTNAME);
added the line to above code..Now I didn't get any error and also no output my reponseText is null..
Later I tried with $.ajax
code is as follows:
$.ajax({
url:url,
type: "POST",
data:req,
dataType:"xml",
crossDomain:true,
success: function (response) {
alert(response);
},
error:function(error1)
{
alert(error1);
}
});
I am getting same error...please help me.One thing is I cannot change the service now..