Difference between revisions of "User:Afuna/jquery.ajaxtip.js usage"

From Dreamwidth Notes
Jump to: navigation, search
(Created page with "jquery.ajaxtip.js is available for general use in your own code. Here's a draft example of use: self.element.ajaxtip({namespace:"yourownplugin"}); And then get it to load info...")
 
m
 
Line 1: Line 1:
 
jquery.ajaxtip.js is available for general use in your own code. Here's a draft example of use:
 
jquery.ajaxtip.js is available for general use in your own code. Here's a draft example of use:
 
+
<syntaxhighlight lang="javascript">
 
self.element.ajaxtip({namespace:"yourownplugin"});
 
self.element.ajaxtip({namespace:"yourownplugin"});
 +
</syntaxhighlight>
  
 
And then get it  to load information using:
 
And then get it  to load information using:
 +
<syntaxhighlight lang="javascript">
 
self.element.ajaxtip.("load", {  // same arguments to $.ajax, e.g.,
 
self.element.ajaxtip.("load", {  // same arguments to $.ajax, e.g.,
 
   url: posturl,
 
   url: posturl,
Line 19: Line 21:
 
   }
 
   }
 
})
 
})
 +
</syntaxhighlight>

Latest revision as of 09:29, 29 March 2011

jquery.ajaxtip.js is available for general use in your own code. Here's a draft example of use:

self.element.ajaxtip({namespace:"yourownplugin"});

And then get it to load information using:

self.element.ajaxtip.("load", {  // same arguments to $.ajax, e.g.,
  url: posturl,
  data: postdata,
  success: function( data, status, jqxhr ) {
    // successfully posted, but return value indicated action wasn't successful
    if ( data.error ) { self.element.ajaxtip( "error", "error message" ) }
    else { self.element.ajaxtip("success", "success msg"); }
    self._trigger( "complete" );
  },
  error: function( jqxhr, status, error ) {
    // got back 404, 403, didn't load the page at all, etc
    self.element.ajaxtip( "error", "error message") }
    self._trigger( "complete" );
   }
})