Categories: Programming & Coding

Send Post Data While Redirecting With JQuery

Do you want to redirect after form submit in jquery and want to know how to redirect to another page after submitting form data in jquery ? Here is a way to submit data in jquery and redirect to another page.

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 Post Redirection


var myRedirect = function(redirectUrl) {
var form = $('<form action="' + redirectUrl + '" method="post">' +
'<input type="hidden" name="parameter1" value="sample" />' +
'<input type="hidden" name="parameter2" value="Sample data 2" />' +
'</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.

ProWebGuru

Mostly I write about technology related stuff on https://www.prowebguru.com Recently I have started making videos also. Mostly blog posts & videos are related to technology, programming and learning some new tips and tricks related to windows, wordpress, google app script, technical, programming, javascript, jquery and other coding related stuff. Youtube channel - https://www.youtube.com/user/prowebguru

Recent Posts

GPT 5.4: Powerful AI Breakthrough – 7 Game-Changing Features, Launch Date & Full Guide

GPT 5.4: The Next-Generation AI Model Transforming Reasoning, Coding, and Productivity Artificial Intelligence is evolving…

1 day ago

GPT‑5.3 Instant Explained: Faster, Smarter & Fewer Refusals

GPT-5.3 Instant is OpenAI's latest ChatGPT model update, prioritizing smoother conversations, fewer refusals, and higher…

2 days ago

Free Perplexity Pro for Airtel Customers: Unlock Advanced AI Assistance at No Cost!

Are you tired of scrolling endlessly through Google results trying to find clear, trustworthy answers?…

4 months ago

Unlocking Collaborative Coding with GitHub Copilot Spaces

In recent years, the process of software development has rapidly evolved—developers demand smarter tools and…

4 months ago

ChatGPT Go Now Free in India: Opening Doors to Advanced AI Capabilities

India has emerged as one of the fastest-growing and most significant markets in the global…

4 months ago

AgentKit by OpenAI: Redefining the Future of AI Agent Development

On October 6, 2025, OpenAI unveiled AgentKit, a unified suite of tools designed to help developers and…

5 months ago

This website uses cookies.