function requestServer ()
{
var query = "field=vale&field1=val1&..."
var request = {};
request['url'] = "server url ";
request['handleAs'] = "xml"; // can be json,text,html
request['load'] = showResult; // which function to call on getting response from server
request['error'] = showError; // for any error which function to call
request['postData'] = query; // Send query to server
dojo.rawXhrPost(request); // Actuall call the XML-HTTP request
}
function showResult (response)
{
alert(response)
}
function showError(response)
{
alert("Error : " + response);
}
data posted in postData will not HTML escaped.
ReplyDeleteinstead use
data = { field1 : "value1",
field2 : "value2"}
request['content'] = data;
This will HTML encode the data