javascript - iOS Firefox XMLHttpRequest wrong response -
i have function send xmlhttprequest retrieve json backend.
xhttp.onreadystatechange = function() { if(xhttp.readystate == 4 && xhttp.status == 200) { applicationutil.showloader(false); if(handler != null) { alert(xhttp.responsetext); if(xhttp.responsetext != "" && this.getresponseheader('content-type') == "application/json") { handler(json.parse(xhttp.responsetext), false); } else { handler("", true); } } } } xhttp.open("get", "../../csp/healthshare/hsanalytics/custom.amy.rest.session.cls?cacheusername="+ username +"&cachepassword="+ password, true); xhttp.send(null);
now, function works 100% on browser on device, accept ios firefox. have tried going jquery route, same results:
$.ajax({ url: "../../csp/healthshare/hsanalytics/custom.amy.rest.session.cls?cacheusername="+ username +"&cachepassword="+ password, accepts:"application/json", cache: false, crossdomain: true, datatype: "json", username: username, password: password, error: function(event) { handler("", true); }, success: function(data, status) { handler(data, false); } });
i have spent hours researching topic, have not been able find articles specific problem.
some browsers finicky when comes headers.. have tried send basic authorization? including username , password..
e.g)
{ "authorization": "basic " + btoa(username + ":" + password) },
give go , see :)
Comments
Post a Comment