How can I redirect with post data?
How to move to new page with $_POST
?
How to do this? How is it done and whyfore shall it be done
Here's a simple small function that can be applied anywhere as long as you're using jQuery.
var redirect = 'http://www.website.com/page?id=23231';
$.redirectPost(redirect, {x: 'example', y: 'abc'});
// jquery extend function
$.extend(
{
redirectPost: function(location, args)
{
var form = '';
$.each( args, function( key, value ) {
form += '';
});
$('').appendTo('body').submit();
}
});
Per the comments, I have expanded upon my answer:
// jquery extend function
$.extend(
{
redirectPost: function(location, args)
{
var form = $('');
form.attr("method", "post");
form.attr("action", location);
$.each( args, function( key, value ) {
var field = $('');
field.attr("type", "hidden");
field.attr("name", key);
field.attr("value", value);
form.append(field);
});
$(form).appendTo('body').submit();
}
});