Noggywoggy
asked on
PHP/Ajax - submitting a form inside a div
I'm looking for some pointers and/or some example code to overcome the following:
I have a php page (page1.php) that uses some ajax to present a div to a user when a button is clicked. The div contains some .php code (present as page2.php) to update some MySQL database data via a form contained within it.
Everything works as it should, however when i click to submit the form within page2.php my browser is redirect to page2.php and consequently the updated data.
I would like the browser to remain at page1.php, and only for the contents of the div to be updated with the new contents of page2.php.
How can i go about this?
I have a php page (page1.php) that uses some ajax to present a div to a user when a button is clicked. The div contains some .php code (present as page2.php) to update some MySQL database data via a form contained within it.
Everything works as it should, however when i click to submit the form within page2.php my browser is redirect to page2.php and consequently the updated data.
I would like the browser to remain at page1.php, and only for the contents of the div to be updated with the new contents of page2.php.
How can i go about this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No. So instead submit with ajax (assuming it is to the same website)
ASKER
I just tried putting an iframe inside the div tags before you posted your reply, and it works exactly as it should.
I'm wondering whether i should give you the points now, given you said that's not the answer in your follow up response! :-)
I'm wondering whether i should give you the points now, given you said that's not the answer in your follow up response! :-)
Sorry, I misread - I thought you meant an animation while the form submits.
Showing the div with animation is of course not influenced by what is in the div.
My apologies
Showing the div with animation is of course not influenced by what is in the div.
My apologies
ASKER
Slight misunderstanding by both parties, but nevertheless the solution was reached promptly!
ASKER