Using XMLHttpRequest, jquery is looking for some help in changing AJAX from AJAX to the following?
$ AJAX ({url: 'api / dev / blah? Id = 4f', type: 'received', first time: function (req) {req.setRequestHeader ("accepted", "app / XML");}, success: function (Consequence) {warning ('success'); // parse XML here ...}, error: function () {warning ('error';}}); As I have tried to do something, I can not see the request sent in an accomplished person, no response or error is not used (information about XML): < Pre> function junk () {var request = new XMLHttpRequest (); Request.addEventListener ('load', success callback, incorrect); Request.open ("GET", 'api / dev / blah? Id = 4F Request.setRequestHeader ("accept", "application / xml"); Request.setRequestHeader ("content-type", "app / XML"); sent request ();} function success callback (data) {Warning ('success');}
to:
function makeHttpObject (try) {try new XMLHttpRequest ()}} hold (error) {} try {return new ActiveXObject (try "Msxml2.XMLHTTP");} hold (error) {} {new ActiveXObje Return ct ("Microsoft.XMLHTTP");} catch (error) {} throw new error ("Could not create HTTP request object."); } Var request = makeHttpObject (); Request.open ("GET", "API / dev / blah? Id = 4F", true); Request.setRequestHeader ("Accept", "App / XML"); Request.setRequestHeader ("content-type", "app / XML"); Request.send (zero); Request.onreadystatechange = function () {if (request.readyState == 4 & request.status == 200} {console.debug (request.responseText); }};
Comments
Post a Comment