JQuery/Javascript HTTP POST not working in IE or Firefox -
i'm struggling getting http post work in firefox , ie,
it works in chrome.
here current code:
$(function () { $('.scpracticetest').on('click', function (e) { var guid = jquery.guid.new(); var testcode = $(this).attr('testcode'); $.support.cors = true; $.ajax({ type : 'post', url: 'https://sc-practice.content.saville.int/sites/api/integration/savillelegacy/createcandidate.ashx', contenttype: 'application/x-www-form-urlencoded', data: { clientid: "4d102b05-8949-4b04-a87a-59ac5a88fc65", username: "practiceintegration", password: "practiceintegration", givenname: guid, familyname: guid, culturecode: "en-gb"}, success: function (data) { candidate = $(data).find("accessid").text(); window.location.replace("https://sc-practice.content.saville.int/sites/api/integration/savillelegacy/assessment.ashx?clientid=4d102b05-8949-4b04-a87a-59ac5a88fc65&username=practiceintegration&password=practiceintegration&accessid=" + candidate + "&testcode=" + testcode + "&returnurl=https://www.savilleconsulting.com/products/test-aptitude-preparation-guides-and-advice/"); }, error: function (data) { alert(data.statustext); } }) }) });
i have jquery guid linked -
jquery.extend({ guid: { set: function (val) { var value; if (arguments.length == 1) { if (this.isvalid(arguments[0])) { value = arguments[0]; } else { value = this.empty(); } } $(this).data("value", value); return value; }, empty: function () { return "00000000-0000-0000-0000-000000000000"; }, isempty: function (gid) { return gid == this.empty() || typeof (gid) == 'undefined' || gid == null || gid == ''; }, isvalid: function (value) { rgx = new regexp("\\b(?:[a-f0-9]{8})(?:-[a-f0-9]{4}){3}-(?:[a-f0-9]{12})\\b"); return rgx.exec(value) != null; }, new: function () { if (arguments.length == 1 && this.isvalid(arguments[0])) { $(this).data("value", arguments[0]); value = arguments[0]; return value; } var res = [], hv; var rgx = new regexp("[2345]"); (var = 0; < 8; i++) { hv = (((1 + math.random()) * 0x10000) | 0).tostring(16).substring(1); if (rgx.exec(i.tostring()) != null) { if (i == 3) { hv = "6" + hv.substr(1, 3); } res.push("-"); } res.push(hv.touppercase()); } value = res.join(''); $(this).data("value", value); return value; }, value: function () { if ($(this).data("value")) { return $(this).data("value"); } var val = this.new(); $(this).data("value", val); return val; } } })();`
any ideas massive help!
Comments
Post a Comment