Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8335097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:33:45+00:00 2026-06-09T03:33:45+00:00

So I learned recently that if you use jquery $.post to post back to

  • 0

So I learned recently that if you use jquery $.post to post back to a PHP script, that you cannot then do an @header redirect within that script (even if you use exit(); immediately after it).

This is enormously depressing news since I have an important redirect/flash message class that I use a lot after a form submission is successfully executed.

The fact that jQuery post is “greedy” and doesn’t let the php script interrupt it is a huge limitation.

Does anyone know of a solution that will let me ajax post form data back to PHP, and then redirect from within PHP? Duplicating the redirect/flash message class in javascript is not really an option for me.

Does anyone know of a way to overcome this issue?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T03:33:46+00:00Added an answer on June 9, 2026 at 3:33 am

    Your script redirects, and your JavaScript (jQuery) gets the result from the redirect I think, or your return includes a 302: redirect header.

    Since your script uses its own request, the redirect you tell it to do will not update the browser, and that functionality will never exist. You have to respond to the request headers from the server in your client side code to respond to whatever you want to do.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently learned how to use automake, and I'm somewhat annoyed that my compile
Even though I am a long time C programmer, I only recently learned that
I recently learned that Unicode is permitted within Java source code not only as
Recently I've been researching the use of Beanstalkd with PHP. I've learned quite a
I have recently learned that you can use a neat switch statement with fallthrough
I recently learned that table valued functions are not allowed with Entity Framework 4.1.
I recently learned that all stl containers have swap function: i.e. c1.swap(c2); will lead
I have recently learned to create dynamic links via php, but my problem today
I've recently learned how to join 2 arrays using the + operator in PHP.
I've just recently learned how jquery can access dynamically generated content, by placing a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.