I've fixed the problem so that a given type of xml forces an responseXML
regardless of the response header. For me it's ok for local AJAX requests
and also for remote requests wich provide a content-type response header.

I changed:

httpData: function(r,type) {
          var ct = r.getResponseHeader("content-type");
          var xml = ( !type || type == "xml" ) && ct && ct.indexOf("xml") >=
0;
          return xml ? r.responseXML : r.responseText;
}

to:

httpData: function(r,type) {
          var ct = r.getResponseHeader("content-type");
          var xml = ( !type || type=="xml" ) || ( ct && ct.indexOf("xml")>=0
);
          return xml ? r.responseXML : r.responseText;
}

I'm not sure how to supply a patch and I think it's better if one of the
AJAX developers cross-checks my modification. Maybe I miss something...

I'm also wondering why the .get() method with the callback function as
second parameter didn't shift the type. 

        get: function( url, data, callback, type ) {
                if ( data.constructor == Function ) {
                        callback = data;
                        data = null;
                }
                
So if I omit the data parameter and the 2nd. argument is a function so that
the data become the callback function, the type is not shifted.
So you can't call get("myurl", myCallback, "xml") and
get("myurl",null,myCallback,"xml") results in a JS error. 
Instead you must call get("myurl","",myCallback,"xml") with a empty dummy
parameter agument.
The following modification should fix this - the type parameter is also
shifted.

        get: function( url, data, callback, type ) {
                if ( data.constructor == Function ) {
                        if(callback) type = callback; //shift parameters if
data is a function
                        callback = data;
                        data = null;
                }

And a last thought: Shouldn't, the post() function act in the same way as
get() with an optional data param? BTW - the documentation should someday
reflect on "optional" parameters.


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to