javascript - How do I exchange data via JSONP using jQuery with Safari? -
i use jquery exchange data using jsonp python server, works fine, e.g. in chrome.
but in safari not work. looking in safari console error "[error] failed load resource: die netzwerkverbindung wurde unterbrochen. (here, line 0)". there seems network error in safari. looking @ server side can see, request reaches server. there processed in right way , reply generated. server's reply can't processed in safari.
<script src="jquery.js"></script> <script src="jquery.mobile-1.4.5.js"></script> $.ajax({ url : "http://127.0.0.1:8888/url/here?callback=?", data: {request: "get_text", value: " "}, datatype: 'jsonp', beforesend: setheader, success: function(data){ console.log(data) $("#page_content").html(data.reply); }, error: function (request, status, error) { console.log(error ); } }); function setheader(xhr) { xhr.setrequestheader('access-control-allow-origin', '*'); xhr.setrequestheader("access-control-allow-headers", "x-requested-with"); }
i googled lot , tried several implementations. tried change ip hostname. added setheader function, did not solve problem, either.
how can exchange data jsonp (with jquery or java script in general) in safari? know working implementation?
Comments
Post a Comment