I was trying to use JQuery Ajax Request but I faced a error when Ajax Object starts processing the ResponseXml it always show error "parsererror".
this is my JQuery code.
var code = '123';
$.ajax({
type: 'GET',
url: 'ajxserv/?code=' + code,
dataType: 'xml',
success: function(xml) {
alert(xml);
alert($(xml).find("Table").text());
$(xml).find("Table").each(function() {
alert($(this).find("Title").text());
});
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert(textStatus);
}
});
I tried to change the url of the request to a local Xml File "test.xml" it work OK but when I change the extension it was not working and shows the "parsererror" exception.
after hours of Googling to find a solution I found it on StackOverflow.com.
simply the solution is that you have change the Response MIME type from "text/html" to "text/xml". To do that only you have to add:
Response.ContentType = "text/xml";
before your Response.Write("xml data");

