jquery - CORS asyncronous ajax call with xhrFields is not working across all browsers (IE8) -
i'm making ajax call across cross domain url , fails in ie8 using below code.it fails in ie8 error object or property not defined, , gives response undefined. have set , $.support.cors = true; $.ajax({
async: false, cache: false, url: "http://test/price", crossdomain: true, type: "post", datatype: "json", data: jsondata,
xhrfields: { withcredentials: true }, success: function (response) { } error: function (xhr, exception) { } above code works in firefox , chrome browsers. make work in ie8, removed below part of code xhrfields: { withcredentials: true },
now works in ie8, ie8+ browsers fails in chrome , firefox , complains "401 - unauthorized: access denied due invalid credentials.you not have permission view directory or page using credentials supplied"
i tried forcing in header section in ajax call using below code, it's of no use. headers: {
"content-type":"application/x-www-form-urlencoded", "access-control-allow-origin": "*", "access-control-allow-credentials":"true", "access-control-allow-headers":"content-type, origin, authorization, x-requested-with, accept", "access-control-allow-methods": "post" }
i tried suggestions in posts, none worked can please me fix in ie8+, chrome , firefox browsers.
Comments
Post a Comment