Reputation: 1129
I am using Ajax to display some content inside a form in my page that have an id
of display
as below
<form method="post"><div id="display"></div></form>
In the content that displayed by Ajax
, there is a button named assign
. I am using php to check if form submitted and if it is, then it will redirect to another page as below
if(isset($_POST['assign'])){
header("Location: trial.php");
}
But somehow it is not going to that page. Does anyone know what am I doing wrong here?
Edit 1
More explanation. From main page, using Ajax
, I am directing to a php page where it echo
some information including echo
a button to main page. Those information will be showed in the main page in the display
id. But when I press the button, form is not submitting
Upvotes: 0
Views: 42
Reputation: 5192
That's not how AJAX works.
F12
in Chrome).Network
tab on top.Assign
button.Response
tab.Do you see the HTML data you were expecting? If you want an AJAX response to change your current browser URL, you'll need to instead "send back" to the web page a response that tells your JS that it should force a URL change.
Upvotes: 2