Popup

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

Labels:

0 comments

jQuery - Extend tablesorter plugin

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

Labels: ,

0 comments

JSON with Padding = JSONP

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:

Labels: , ,

0 comments

Reloading partial page content with JavaScript

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:

Labels:

0 comments