I have to make ajax request for mobile web app, I used the following code
$.ajax({
type: type, //GET or POST or PUT or DELETE verb
url: requestURL, // Location of the service
// contentType: "application/x-www-form-urlencoded", // content type sent to server
dataType: "xml", //Expected data format from server
processData: false, //True or False
success: successCallback, //On Successfull service call
error: serviceFailed// When Service call fails
});
But it failed with error "Error: Access is denied. I am calling .aspx service from javascript
You cannot submit AJAX requests to domains other than the one serving the web page. If it is a sub domain causing the problems, you can use this code to resolve it.
document.domain = location.host.replace(/^.*?([^.]+\.[^.]+)$/g,'$1');