This is one of those situations where I feel like I\'m missing a crucial keyword to find the answer on Google...
I have a bag of parameters and I want to make the br
Here's what I ended up doing, using the tip from redsquare:
(function($) {
$.extend({
doGet: function(url, params) {
document.location = url + '?' + $.param(params);
},
doPost: function(url, params) {
var $form = $("<form method='POST'>").attr("action", url);
$.each(params, function(name, value) {
$("<input type='hidden'>")
.attr("name", name)
.attr("value", value)
.appendTo($form);
});
$form.appendTo("body");
$form.submit();
}
});
})(jQuery);
Usage:
$.doPost("/mail/send.php", {
subject: "test email",
body: "This is a test email sent with $.doPost"
});
Any feedback would be welcome.
Update: see dustin's answer for a version that works in IE8