Problem in calling cross domain service using Jquery
I am trying to call web service (cross domain service) using Jquery.
the below working fine in IE8 , but not in chrome and firefox.
Please help me to resolve this issue. Thanks in advance
Test 1:
=================
<script language ="javascript" type="text/javascript">
function Do() {
$.support.cors = true;
$.ajax({
type: "Get",
url: "url", // Location of the service
data: '{"parameter"="value"}', //Data sent to server
contentType: "application/json;charset-uf8", // content type sent to server
dataType: "xml", //Expected data format from server
success: function(msg) {
//Implement get data from service as you wish
alert("Success");
},
error: function(err) {
// When Service call fails
alert("error");
}
});
}
</script>
Test 2
==========
I am getting error, even when i try access the data from the same domain.
function Do() {
$.support.cors = true;
$.ajax({
type: "GET",
url: "test.xml",
dataType: "xml",
data: "",
headers: { 'Accept': 'text/xml' },
headers: { 'Access-Control-Allow-Headers': 'application/json; charset=utf-8' },
error: function(xml) { alert(xml.text); },
success: function(xml) {
alert("success");
spnid.innerHTML = xml.text;
}
});
}