Can anyone explain how to run PHP code from within javaScript for submit?
Currently I submit the form to a page.php, connect to MySQL, run some queries then build up the HTML and echo it out.
However, I want to do this without going to the page.php as I am trying to show the results in an ajax dialog using JQuery-UI. It works, just I have to submit to page.php to make it happen.
Would I do something like build up the code in Javascript writelin statements and dynamically load a div or something?
-
I don't exactly understand Your problem. You can submit data from form using Jquery ajax and on response load it to div. You need to use load(). Give more details.Adam– Adam2010年12月20日 03:58:28 +00:00Commented Dec 20, 2010 at 3:58
1 Answer 1
Use jQuery's post() method to send the request to page.php from JavaScript asynchronously. You can use the success option to show the dialog http://api.jquery.com/jQuery.post/