Re: [jQuery] ajax form docs
Mike Alsup schrieb: >> So don't see the need for $.get and $.post anymore. >> > > It's not a need, it's a convenience. Just like getJSON and getScript. > Ok, $.get and $.post both provide an interface with "static" parameters, that makes them more convienent then $.ajax. Good to talk about it :-) -- Jörn Zaefferer http://bassistance.de ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] ajax form docs
> So don't see the need for $.get and $.post anymore. It's not a need, it's a convenience. Just like getJSON and getScript. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] ajax form docs
Mike Alsup schrieb: >> While we are at it: A get request can send it's data only by appending >> the query string to the URL, right? Can this be handled by $.ajax, too? >> > > Sure, it could. I think it makes sense to move all that logic into > $.ajax but I would keep $.get and $.post because they are nice > convenience methods. $.ajax supports a lot of options and having some > of them defaulted properly via $.get and $.post makes sense. > If you put the logic into $.ajax, the only thing left for $.get to do is just what the $.ajax success callback already provides. And it's nearly the same for $.post, only that you type $.post({...}) instead of $.ajax({type: "post", ...}); So don't see the need for $.get and $.post anymore. -- Jörn Zaefferer http://bassistance.de ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] ajax form docs
> While we are at it: A get request can send it's data only by appending > the query string to the URL, right? Can this be handled by $.ajax, too? Sure, it could. I think it makes sense to move all that logic into $.ajax but I would keep $.get and $.post because they are nice convenience methods. $.ajax supports a lot of options and having some of them defaulted properly via $.get and $.post makes sense. Mike ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] ajax form docs
Mike Alsup schrieb: >> Of couse it would be an ugly API change. If that stuff is integrated >> into $.ajax, we could savely deprecate $.get and $.post. >> > > Perhaps interrogating the type would work? > > if (typeof data != 'string') > data = jQuery.param(data) > Yeah, that should be pretty safe. If someone has already converted the data, it must be in string format anyway to work. While we are at it: A get request can send it's data only by appending the query string to the URL, right? Can this be handled by $.ajax, too? I'll try to log this discussion here http://jquery.com/dev/bugs/bug/378/ and here http://jquery.com/dev/bugs/bug/377/ -- Jörn Zaefferer http://bassistance.de ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] ajax form docs
> Of couse it would be an ugly API change. If that stuff is integrated > into $.ajax, we could savely deprecate $.get and $.post. Perhaps interrogating the type would work? if (typeof data != 'string') data = jQuery.param(data) ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] ajax form docs
Mike Alsup schrieb: >> I wonder if there is any case where one would use $.ajax without calling >> $.param for any data first. If not, it would be nice to simply integrate >> that call into $.ajax. >> > > That's a good point, Jörn. > Of couse it would be an ugly API change. If that stuff is integrated into $.ajax, we could savely deprecate $.get and $.post. -- Jörn Zaefferer http://bassistance.de ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] ajax form docs
> I wonder if there is any case where one would use $.ajax without calling > $.param for any data first. If not, it would be nice to simply integrate > that call into $.ajax. That's a good point, Jörn. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] ajax form docs
Mike Alsup schrieb: > $.param is a core method which converts an object or an > array into a query string. > I wonder if there is any case where one would use $.ajax without calling $.param for any data first. If not, it would be nice to simply integrate that call into $.ajax. -- Jörn Zaefferer http://bassistance.de ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] ajax form docs
> What is "param" and what is "formdata" formdata() is an old function that used to exist in the form plugin long ago. $.param is a core method which converts an object or an array into a query string. > How can I submit a form then via ajax? Use the form plugin: http://jquery.com/dev/svn/trunk/plugins/form/form.js?format=txt It works with all of the released versions of jQuery (1.0 and later). Mike ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/