Opened 12 years ago
Closed 12 years ago
#9347 closed enhancement (wontfix)
$.load don't inherit from $.ajax
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | low | Milestone: | 1.7 |
Component: | ajax | Version: | 1.6.1 |
Keywords: | Cc: | jaubourg | |
Blocked by: | Blocking: |
Description (last modified by )
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.
Change History (18)
comment:1 Changed 12 years ago by
comment:2 Changed 12 years ago by
Component: | unfiled → ajax |
---|---|
Priority: | undecided → low |
Resolution: | → wontfix |
Status: | new → closed |
load is different in that it is not $.load, but $.fn.load. Generally, functions on the prototype should return the current jQuery instance.
comment:3 Changed 12 years ago by
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?
comment:4 Changed 12 years ago by
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
comment:5 Changed 12 years ago by
Cc: | jaubourg added |
---|---|
Status: | reopened → open |
comment:6 Changed 12 years ago by
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
comment:7 Changed 12 years ago by
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?
comment:8 Changed 12 years ago by
Perhaps something like
$(elem).load().promise("ajax")
I think I would like that.
comment:11 Changed 12 years ago by
-1, The more I think about it, the less I like this. If you want to do this, use ajax directly.
comment:13 Changed 12 years ago by
Description: | modified (diff) |
---|
-1, Rare cases may need additional code. No shame in that.
comment:16 Changed 12 years ago by
Description: | modified (diff) |
---|
+1 I don't see why there shouldn't at least be a mechanism to get at the promise from a $.fn.load...
comment:17 Changed 12 years ago by
Description: | modified (diff) |
---|
-1, .load() is very much a convenience method, use $.ajax if you need more control
comment:18 Changed 12 years ago by
Description: | modified (diff) |
---|---|
Keywords: | 1.7-discuss removed |
Milestone: | 1.next → 1.7 |
Resolution: | → wontfix |
Status: | open → closed |
I mean minus signs, not bullets (diff patch style).