jquery - Safari browser ajax request error -


i'm making ajax request generic handler handler.ashx, forwards request rest service in domain. handler used achieve cross-domain call. data in firefox & chrome. not in safari on windows 7(ver. 5.1.7)

$.ajax({          url: 'handler.ashx',          type: 'get',          contenttype: 'application/json; charset=utf-8',          datatype: 'json',          async: false,          timeout: 20000,          data: data,          success: function (received_data) {              // process data          },          error: function (err) {              console.log(err);          } }); 

my handler.ashx code:

httpwebrequest req = (httpwebrequest)webrequest.create(new uri("http://xxx.xxx.xx.xxx/mywebservice/service.svc/downloadfile"));     req.contenttype = "application/json; charset=utf-8";     req.timeout = 60000;      using (webresponse resp = req.getresponse())      {          streamreader reader = new streamreader(resp.getresponsestream());         string responcefromservice = reader.readtoend();         context.response.contenttype = "application/json; charset=utf-8";         context.response.write(responcefromservice);     } 

the error is:

network_err: xmlhttprequest exception 101

from can find surfing around on web, , own testing, safari times out synchronous ajax calls after 10 seconds. and, there no way around it. (i've tried.) not bug. apple's way of hinting if call can't reliably return in 10 seconds, shouldn't using synchronous call. in fact, shouldn't ever use synchronous call because there no way know if call return in 10 seconds. need refactor code have whatever happen after ajax call, happen via callback routine, , not in-line.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -