Where is ajax defined in the source and how it is bound to the jQuery object?
I ran a search for it and found it on 5993 inside this thing called:
jQuery.extend({
where fn is an alias for prototype.
How does Jquery know were to find ajax() when you call it. More generally how does extend work?
The
extendmethod copies properties from one object to another. With just one argument, it copies properties tothis, so in this case it’s copying the properties to thefnobject itself.edit in my copy of the 1.7.1 code, the “ajax” method actually is copied in by
jQuery.extend(), notjQuery.fn.extend(). It’s the same function;extendis bound to both the jQuery object and to the “fn” object (the internal constructor function). When it’s called asjQuery.extend({ ... })therefore, the properties are copied to the jQuery object (function) itself.