$.ajax() function working in IE but not in Chrome and FF
I hope this question is not asked in this forum before, tried searching alot but none matched or worked for me. Below is the JSFiddle link of code:
JSFiddle (Try to save the file(code given below) as html and run it using chrome)
Everything is working well in IE8 and IE9 but not in any other browsers. I tried looking for the problem in Chrome from which I got
XMLHttpRequest cannot load http://v3.actisku.com/GetUserPostData?pid=Test-37&surv=1170. Request header field X-Requested-With is not allowed by Access-Control-Allow-Headers
I tried searching for necessary solution i.e CORS but couldn't figure out the solution. I am side by side looking for the same.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<html><head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"></script>
<script type="text/javascript">
$
(document).ready(function () {
var contents = $.ajax({
url
: 'http://v3.actisku.com/GetUserPostData?pid=Test-37',
cache
: false,
dataType
: 'html',
data
: { surv: '1170'},
async
: false
}).responseText;
var test = contents;
alert
(test);
test
= test.replace(/\t/g, ';');
alert
(test);
test
= test.replace(/\n/g, 'break');
alert
(test);
$
('#contentArea').attr('value', test);
});
</script>
</head>
<body>
<textarea id="contentArea" rows="10" cols="50"></textarea>
</body>
</html>
Regards,
Ishan