Reputation: 1445
I am creating a web application which hosted on a domain example.com, I would like to download a binary file of 1 MB to check the download speed, its working fine if binary file hosted on same domain.
But when I tried with another domain, it stops working. I tried the crossdomain property but noting happens.
My code is below:
jQuery143.ajax({
type: 'GET',
url: 'http://example2.com/myfile.bin?id=xxxxxxx',
dataType: 'application/octet-stream',
success: function (msg) {
},
complete: function (xhr, textStatus) {
}
});
When I replaced "example2.com" with "example.com", its working fine. So please let me know how can I resolved this issue.
I put the crossdomain.xml on example2.com, so request status is OK.
Thanks, Laxmilal Menaria
Upvotes: 1
Views: 1808
Reputation: 699
I think you need to set the 'crossDomain' parameter to true for cross domain request. Please check this one http://api.jquery.com/jQuery.ajax/
Upvotes: 0
Reputation: 8411
Your browser is not allowing to make a cross domain call. JSONP seems to be only option if you are calling from browser.
http://en.wikipedia.org/wiki/JSONP
Upvotes: 1
Reputation: 15881
you can try sending datatype as "jsonp" for cross domain request and you can check this link for help Cross domain Get with Jquery and also this link helps you to get started remote JsonP
from Jquery.ajax
"jsonp": Loads in a JSON block using JSONP. Adds an extra "?callback=?" to the end of your URL to specify the callback. Disables caching by appending a query string parameter, "_=[TIMESTAMP]", to the URL unless the cache option is set to true.
Upvotes: 1