Bug Tracker

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#337 closed enhancement (fixed)

More consistent/feature rich ajax programming model

Reported by: Andrey Skvortsov Owned by:
Priority: critical Milestone:
Component: ajax Version:
Keywords: Cc:
Blocked by: Blocking:

Description

Please,see discussion http://jquery.com/blog/2006/10/13/minor-api-change-in-102/#comment-3582 http://jquery.com/blog/2006/10/27/jquery-103/#comment-3736

I'm missing about xmlhttp object almost every time I use $.get/post/load etc.,particularly if I work with xml data."state" methods-"success"/"complete"/"error" would be useful for other ajax methods beside of generic $.ajax().

Thanks.

Change History (3)

comment:1 Changed 13 years ago by joern

Milestone: 1.0
Priority: majorcritical
Version: 1.0

Rather then enhancing get/post, I'd deprecate them both and promote more use of $.ajax. It uses "GET" as default, therefore $.get is redundant anyway. get and post automatically encode their data paramter, $.ajax does not. The "encoding" is the same for both get and post, so this could be moved to $.ajax, but not without an API change.

load() automatically inserts the loaded stuff into the DOM, is there really a usecase where load() needs access to the response object?

comment:2 Changed 13 years ago by Andrey Skvor

Maybe,this will work...but $.post/get are simply convenient wrappers for $.ajax without "method" argument anyway,but responseXml must be available IMHO(in success/error too,not only in complete).load() need to access response object in case of chained/sequential/dependent processing(load,...,...),same as JQuery processing model itself.

comment:3 Changed 13 years ago by joern

Resolution: fixed
Status: newclosed

Fixed in SVN: The callback for load() gets the responseText as first parameter, the status as second and the actualy response as third parameter.

Any limitations mentioned for $.get and $.post won't fix, because those are just convenience methods for special cases.

Due to some refactorings to the AJAX module, it is now possible to pass a key/value object to $.ajax, it gets converted into a query string if it isn't a string already.

Expect a new feature in jQuery 1.1: Global settings for $.ajax that allow more then one request to reuse the same settings.

Note: See TracTickets for help on using tickets.