I am using this code:
$.ajax({
url: 'http://mysharepointsite.com/SitePages/Home.aspx',
type: 'HEAD',
error: function () {
//file not exists
alert('not ok');
},
success: function () {
//file exists
alert('ok');
}
});
I am calling it from another domain, it is failing because of the cross-domain issue. How can i overcome this?
You can make a proxy for the server to make the connection then make ajax calls to the proxy, but you can also use James Padolsey’s cross-domain ajax mod which will use YUI in the background to handle the cross-domain requests, it’s a drop-in replacement for jQuery’s
.ajax()method. it’s on github here