ajax datasrc code example
Example 1: ajax exmaple\
$.ajax({
url:'your url',
type: 'POST',
data: { myData: 'This is my data.' },
success: function (data, status, xhr) {
$('p').append('status: ' + status + ', data: ' + data);
},
error: function (jqXhr, textStatus, errorMessage) {
$('p').append('Error' + errorMessage);
}
});
Example 2: ajax request qml
function makeRequest()
{
var doc = new XMLHttpRequest();
msg.text = "";
doc.onreadystatechange = function() {
if (doc.readyState == XMLHttpRequest.HEADERS_RECEIVED) {
showRequestInfo("Headers -->");
showRequestInfo(doc.getAllResponseHeaders ());
showRequestInfo("Last modified -->");
showRequestInfo(doc.getResponseHeader ("Last-Modified"));
} else if (doc.readyState == XMLHttpRequest.DONE) {
var a = doc.responseXML.documentElement;
for (var ii = 0; ii < a.childNodes.length; ++ii) {
showRequestInfo(a.childNodes[ii].nodeName);
}
showRequestInfo("Headers -->");
showRequestInfo(doc.getAllResponseHeaders ());
showRequestInfo("Last modified -->");
showRequestInfo(doc.getResponseHeader ("Last-Modified"));
}
}
doc.open("GET", "data.xml");
doc.send();
}