Re: [jQuery] Setting AJAX headers, and selecting namespaced nodes
That would be a nice addition. Has there been any discussion of having jQuery automatically use: X-Requested-With: XMLHttpRequest It already does. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Setting AJAX headers, and selecting namespaced nodes
malsup wrote: That would be a nice addition. Has there been any discussion of having jQuery automatically use: X-Requested-With: XMLHttpRequest It already does. Excellent! One more reason to keep using it. -- View this message in context: http://www.nabble.com/Setting-AJAX-headers%2C-and-selecting-namespaced-nodes-tf2124789.html#a5905881 Sent from the JQuery forum at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Setting AJAX headers, and selecting namespaced nodes
Mitchell Lane wrote: This would allow the programmer to set and override their own HTTP headers. That would be a nice addition. Has there been any discussion of having jQuery automatically use: X-Requested-With: XMLHttpRequest ...in the headers of its AJAX calls? There's a few different libraries out there using it, and it seems to be good etiquette to do so. It would provide a simple and consistent means of differentiating between AJAX and non-AJAX calls on the server side. Thanks, Jason -- View this message in context: http://www.nabble.com/Setting-AJAX-headers%2C-and-selecting-namespaced-nodes-tf2124789.html#a5901298 Sent from the JQuery forum at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Setting AJAX headers, and selecting namespaced nodes
I've pinpointed both my issues, and would like to propose the following changes: In jquery/jquery.js, line 356, replace: $.g = { '': m[2] == '*' || a.nodeName.toUpperCase() == m[2].toUpperCase(), with: $.g = { '': m[2] == '*' || a.localName.toUpperCase() == m[2].toUpperCase(), This would allow nodes with prefixes to still be addressed using the $(path, context) function (nodes such as 'D:response' can be addressed using the path response, etc.). In ajax/ajax.js, line 12, replace function $.xml with: $.xml = function( type, url, data, ret, headers ) { var xml = new XMLHttpRequest(); if ( xml ) { xml.open(type || GET, url, true); if ( data ) xml.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); if ( headers ) for ( var name in headers ) xml.setRequestHeader(name, headers[name]); xml.onreadystatechange = function() { if ( xml.readyState == 4 ) { if ( ret ) ret(xml); $.triggerAJAX( $.httpData(xml) ); } }; xml.send(data); } }; This would allow the programmer to set and override their own HTTP headers. If these changes or anything equivalent could be implemented, it'd be greatly appreciated! — Mitch ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/