Safari jquery ajax redirect -
i making $.ajax call external server. server returns redirect, redirected page returning json. works fine on ff , chrome, safari , opera don't it.
here $.ajax code:
$.ajax( { url:url, datatype:"json", success:function(data) { console.log("success"); }, complete:function() { console.log("complete"); } }); in firefox , chrome, works - 'success' called each of ajax responses. in safari , opera however, 'success' never called, 'complete'. network requests console gives me following information:
resolve.json 302 application/json 1817995.json (canceled) undefined where 1717995.json redirection sent resolve.json. i'm not sure why request being canceled (as seems indicated response).
can give assistance on this?
imho it's cross-domain (origin) problem. browser doesn't cross browser ajax requests default. should try use jsonp instead of json:
datatype:"jsonp" but work if there's server support jsonp (in case you'll need specify callback function's name).
if jsonp not supported, can make proxy server. it's not needed. instead of redirecting "download" file 3rd party server , output response.
if it's ok work on newer browsers, can try this (which better solution server side "proxy" imho)
Comments
Post a Comment