Hi Mike,

if I use the following snippet:

var formIdSelector = '#hijax-me';
$(formIdSelector).ajaxForm(formIdSelector);

on a form with GET method it still posts the data. I changed ajaxSubmit 
to this to make it work:

(http://stilbuero.de/demo/jquery/hijax.html
http://stilbuero.de/demo/jquery/form.js)

jQuery.fn.ajaxSubmit = function(target, post_cb, pre_cb, url, mth, 
semantic) {
     var a = this.formToArray(semantic);
     var m = this.attr('method') || 'GET';

     // give pre-callback opportunity to abort the submit
     if (pre_cb && pre_cb.constructor == Function && pre_cb(a, this) === 
false) return;

     url = url || this.attr('action') || '';

     // if no target or 'post' callback was provided then default to a 
callback
     // that evals the response
     var t = target || post_cb || function(r) {
             if (r.responseText) eval.call(window, r.responseText)
         };

     if (t && t.constructor == String)
         if (m == 'GET')
             jQuery(t).load(url + '?' + jQuery.param(a), post_cb);
         else
             jQuery(t).load(url, a, post_cb);
     else
         jQuery.ajax({ url: url, success: t, data: jQuery.param(a), 
type: mth || m});
     return this;
};


Other than that, I'm starting to love this plugin!

-- Klaus



Mike Alsup schrieb:
> I've updated the form plugin once again to fix a bug in ajaxSubmit
> which I found while unit testing.  I thought I'd take this opportunity
> to summarize the changes made recently:
> 
> 1. Incorporated Matt Grimm's optimized serialization code.
> 2. Defaulted the form method to 'GET' per Klaus's suggestion.
> 3. Fixed ticket #160 using suggestions from Renato and Jörn.
> 4. Fixed bug in ajaxSubmit which caused inconsistent callback args in
> post-callback method.
> 5. Fixed bug in image submit element coordinates (requires dimensions plugin)
> 6. Updated documentation in the source file.
> 
> I think (hope) everyone is on-board with the changes listed above.
> I'm also suggesting two other changes:
> 
> 1. Rename form plugin's current "serialize" method to "formToArray"
> 2. Create a new "serialize" method in the plugin which returns the '&'
> delimited string.
> 
> These last two items may cause issues for some but to me they are far
> more intuitive than what we currently have and I think the discussions
> earlier this week were leading in this direction.  Currently, the form
> plugin's "serialize" method returns an array of objects and core's
> "serialize" method returns a '&' delimited string.
> 
> On a final note, I've updated the demo page to include a link to run
> the unit tests.  If some of you Safari users could run the unit tests
> I would appreciate it.
> 
> Demo page: http://malsup.com/jquery/form/
> Unit test: http://malsup.com/jquery/form/test.html
> 
> Mike
> 
> _______________________________________________
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 

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

Reply via email to