Oct 27th, 2008 by admin

This scripts show the content of a div when clicked on an opener.

jQuery – Extend tablesorter plugin
Oct 16th, 2008 by admin

This js code extends the tablesorter plugin in jQuery:

  1. Parser for sorting values like “$1,300.50″
  2. Parser for sorting values like “2 months ago”,”3 years ago” (actual timestamp hide in the comment)
  3. Parser for sorting values like “SMALLER”,”SMALL” (actual text value hide in comment)
  4. Widget to highlight a row when mouse hovers it
  5. Widget to highlight a header when mouse hovers it
  6. Widget to save/memorize sort order via AJAX

Let’s get right into the code:

Demo HTML file

JSON with Padding = JSONP
Aug 19th, 2008 by admin

With JSONP, you can avoid the “Access is Denied” problem when loading a remote AJAX request. jQuery 1.2.x now supports JSONP, you can use that or this simple code snippet. In this example, let’s assume you’re on a page with a remote javascript loaded, now you only want this remote script to reload, not the whole page.

And the result of getJSON.php:

Reloading partial page content with JavaScript
Aug 6th, 2008 by admin

If you need to reload a partial content (not the whole page) with JavaScript, you can easily use AJAX (jQuery is the simplest). But if the content is also from another website (eg: some API), then you can use JSONP (JSON with Padding) to get around the security protection of AJAX requests.

And in the server-side javascript.php, you would return:

»  Substance:WordPress   »  Style:Ahren Ahimsa