Skip to main content

Bug Tracker

Side navigation

#9347 closed enhancement (wontfix)

Opened May 19, 2011 01:26PM UTC

Closed June 06, 2011 10:03PM UTC

$.load don't inherit from $.ajax

Reported by: adrien.dupuis@gmail.com Owned by:
Priority: low Milestone: 1.7
Component: ajax Version: 1.6.1
Keywords: Cc: jaubourg
Blocked by: Blocking:
Description

The $.load() function return ''this''. The $.ajax() request build inside the $.load() can't be accessed for, as example, .abort(). By changing

  • jQuery.ajax({

+ return jQuery.ajax({

  • return this;

$.load could be a true $.ajax shorthand.

Attachments (0)
Change History (18)

Changed May 19, 2011 01:27PM UTC by adrien.dupuis@gmail.com comment:1

I mean minus signs, not bullets (diff patch style).

Changed May 19, 2011 02:24PM UTC by timmywil comment:2

component: unfiledajax
priority: undecidedlow
resolution: → wontfix
status: newclosed

load is different in that it is not $.load, but $.fn.load. Generally, functions on the prototype should return the current jQuery instance.

Changed May 19, 2011 03:25PM UTC by ajpiano comment:3

I'm sort of inclined to agree with the OP that there should be some way to access the Deferred associated with a given $.fn.load call - perhaps something similar to how we are able to do so for animations now?

Changed May 19, 2011 04:47PM UTC by timmywil comment:4

resolution: wontfix
status: closedreopened

Changed May 19, 2011 04:48PM UTC by timmywil comment:5

cc: → jaubourg
status: reopenedopen

Changed May 19, 2011 10:29PM UTC by dmethvin comment:6

This seems like an exceptional case, if it can't be done with one line of code or less I'd prefer we just let people use their own wrapper around $.ajax. #nobloat

Changed May 19, 2011 11:56PM UTC by jaubourg comment:7

I thought about it back when I was working on fn.promise. Fact is you can do element.promise( "someCategory" ). For instance, by default element.promise() is equivalent to element.promise( "fx" ). It's just a question of adding the _mark/_unmark calls where needed.

Dunno if it's that useful though... should we tag this as an 1.7 enhancement proposal?

Changed May 20, 2011 03:17PM UTC by timmywil comment:8

Perhaps something like

$(elem).load().promise("ajax")

I think I would like that.

Changed May 22, 2011 07:27PM UTC by john comment:9

keywords: → 1.7-discuss

Nominating ticket for 1.7 discussion.

Changed May 22, 2011 08:36PM UTC by rwaldron comment:10

description: The $.load() function return ''this''. The $.ajax() request build inside the $.load() can't be accessed for, as example, .abort(). By changing \ - jQuery.ajax({ \ + return jQuery.ajax({ \ - return this; \ $.load could be a true $.ajax shorthand.The $.load() function return ''this''. The $.ajax() request build inside the $.load() can't be accessed for, as example, .abort(). By changing\ - jQuery.ajax({\ + return jQuery.ajax({\ - return this;\ $.load could be a true $.ajax shorthand.

+0,

Changed May 23, 2011 12:57AM UTC by jaubourg comment:11

-1, The more I think about it, the less I like this. If you want to do this, use ajax directly.

Changed May 23, 2011 05:00AM UTC by timmywil comment:12

-1, per my initial reaction + jaubourg's comment

Changed May 24, 2011 10:09PM UTC by dmethvin comment:13

description: The $.load() function return ''this''. The $.ajax() request build inside the $.load() can't be accessed for, as example, .abort(). By changing\ - jQuery.ajax({\ + return jQuery.ajax({\ - return this;\ $.load could be a true $.ajax shorthand.The $.load() function return ''this''. The $.ajax() request build inside the $.load() can't be accessed for, as example, .abort(). By changing \ - jQuery.ajax({ \ + return jQuery.ajax({ \ - return this; \ $.load could be a true $.ajax shorthand.

-1, Rare cases may need additional code. No shame in that.

Changed June 03, 2011 02:05PM UTC by john comment:14

description: The $.load() function return ''this''. The $.ajax() request build inside the $.load() can't be accessed for, as example, .abort(). By changing \ - jQuery.ajax({ \ + return jQuery.ajax({ \ - return this; \ $.load could be a true $.ajax shorthand.The $.load() function return ''this''. The $.ajax() request build inside the $.load() can't be accessed for, as example, .abort(). By changing\ - jQuery.ajax({\ + return jQuery.ajax({\ - return this;\ $.load could be a true $.ajax shorthand.

-1, Uhh yeah, that would be bad.

Changed June 04, 2011 10:16PM UTC by addyosmani comment:15

-1

Changed June 05, 2011 10:17PM UTC by ajpiano comment:16

description: The $.load() function return ''this''. The $.ajax() request build inside the $.load() can't be accessed for, as example, .abort(). By changing\ - jQuery.ajax({\ + return jQuery.ajax({\ - return this;\ $.load could be a true $.ajax shorthand.The $.load() function return ''this''. The $.ajax() request build inside the $.load() can't be accessed for, as example, .abort(). By changing \ - jQuery.ajax({ \ + return jQuery.ajax({ \ - return this; \ $.load could be a true $.ajax shorthand.

+1 I don't see why there shouldn't at least be a mechanism to get at the promise from a $.fn.load...

Changed June 06, 2011 03:16PM UTC by scottgonzalez comment:17

description: The $.load() function return ''this''. The $.ajax() request build inside the $.load() can't be accessed for, as example, .abort(). By changing \ - jQuery.ajax({ \ + return jQuery.ajax({ \ - return this; \ $.load could be a true $.ajax shorthand.The $.load() function return ''this''. The $.ajax() request build inside the $.load() can't be accessed for, as example, .abort(). By changing\ - jQuery.ajax({\ + return jQuery.ajax({\ - return this;\ $.load could be a true $.ajax shorthand.

-1, .load() is very much a convenience method, use $.ajax if you need more control

Changed June 06, 2011 10:03PM UTC by rwaldron comment:18

description: The $.load() function return ''this''. The $.ajax() request build inside the $.load() can't be accessed for, as example, .abort(). By changing\ - jQuery.ajax({\ + return jQuery.ajax({\ - return this;\ $.load could be a true $.ajax shorthand.The $.load() function return ''this''. The $.ajax() request build inside the $.load() can't be accessed for, as example, .abort(). By changing \ - jQuery.ajax({ \ + return jQuery.ajax({ \ - return this; \ $.load could be a true $.ajax shorthand.
keywords: 1.7-discuss
milestone: 1.next1.7
resolution: → wontfix
status: openclosed