we are trying to do a cross-domain GET request using TypeScript. We tested alleady with a XMLHttpRequest, a $.get and $.ajax.
Using XMLHttpRequest, the onreadystatechange never get triggered. When using the $.ajax way, we noticed we received an error (text was 'error' :( ). The strange part is, fiddler returns a 200 response, and looking in a the textview, we can see all the text we requested.
The response the server is sending is HTML / Text. This is the code we tried:
public GetFeatureInfo(url: string): void {
$.ajax({
url: url,
type: 'GET',
cache: false,
dataType: 'text',
beforeSend: function (xhr) {
xhr.overrideMimeType("text/plain; charset=UTF-8");
}
}).done(function (data) {
alert(data);
}).fail(function (jqXHR, textStatus) {
alert("Request failed: " + textStatus);
}).always(function () {
});
}
Any ideas?
Thank you for your help!
Bjorn