comparison default/node_modules/shoestring/src/ajax/load.js @ 0:1d038bc9b3d2 default tip

Up:default
author Liny <dev@neowd.com>
date Sat, 31 May 2025 09:21:51 +0800
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:1d038bc9b3d2
1 //>>excludeStart("exclude", pragmas.exclude);
2 define([ "shoestring", "ajax/ajax" ], function( shoestring ) {
3 //>>excludeEnd("exclude");
4
5 /**
6 * Load the HTML response from `url` into the current set of elements.
7 *
8 * @param {string} url The url to GET from.
9 * @param {function} callback Callback to invoke after HTML is inserted.
10 * @return shoestring
11 * @this shoestring
12 */
13 shoestring.fn.load = function( url, callback ){
14 var self = this,
15 args = arguments,
16 intCB = function( data ){
17 self.each(function(){
18 shoestring( this ).html( data );
19 });
20
21 if( callback ){
22 callback.apply( self, args );
23 }
24 };
25
26 shoestring.ajax( url, { success: intCB } );
27 return this;
28 };
29
30 //>>excludeStart("exclude", pragmas.exclude);
31 });
32 //>>excludeEnd("exclude");