
jQuery redirect/POST plugin
Recently I had to POST some data to an URL from within JavaScript (jQuery) and I found out that there is no easy way to do such thing directly from jQuery, other than to create an HTML form on-the-fly and submit it. Since I had to do similar thing on several locations in my code I’ve decided to pack this code to jQuery plugin so anyone can use it.
Once it is included in your page (after jQuery!) you can call it as simple as:
$().redirect('demo.php', {
'argument1': 'value1',
'argument2': 'value2' //...and so on...
});
This will POST data hashmap (second argument) to demo.php as soon as the function is called.