Social Media Magazine

Send Post Data While Redirecting With JQuery

Posted on the 16 October 2013 by Pro Webguru @prowebguru

To send post data while redirecting from one page to another, we should create a dummy form and hidden input field.
Hidden input fields will be the actual data we need to post.
Pass values to this form in textbox and it will be passed from one page to another.

Jquery send post data and redirect

Jquery Post Redirection

var myRedirect = function(redirectUrl) {
var form = $('' +
'' +
'' +
'');
$('body').append(form);
$(form).submit();
};


Now just assign this variable to the onclick handler of any element. This is a simple way to submit data to another page dynamically when redirecting or moving from one page to another.

Let me know if you know any other way to do this.

Send Post Data While Redirecting With JQueryhttp://www.prowebguru.com/2013/10/send-post-data-while-redirecting-with-jquery/http://www.prowebguru.com/wp-content/uploads/jquery-post-redirect.jpghttp://www.prowebguru.com/wp-content/uploads/jquery-post-redirect.jpg16 October 2013 ProWebGuru Programming & Codingjavascript,jqueryTo send post data while redirecting from one page to another, we should create a dummy form and hidden input field. Hidden input fields will be the actual data we need to post. Pass values to this form in textbox and it will be passed from one page to another. Now just...To send post data while redirecting from one page to another, we should create a dummy form and hidden input field. Hidden input fields will be the actual data we need to post. Pass values to this form in textbox and it will be passed from one page to another.<span id="more-1457"></span> <!--INFOLINKS_OFF--> <!--INFOLINKS_ON--> Now just assign this variable to the onclick handler of any element. This is a simple way to submit data to another page dynamically when redirecting or moving from one page to another. Let me know if you know any other way to do this. ProWebGuru103924578884522256081 [email protected]AdministratorProWebGuru

Back to Featured Articles on Logo Paperblog