I have a basic form. On form submittal I want to post the values via ajax to some php script. The php script performs a calculation (based on the form inputs) and displays a series of charts. I want to show these charts on the page that has the form.
So I think what Im asking is - how do I return the html output of my php file into a div container on the page which has the form.
Can you clarify what the problem is; are you just trying to get started doing this, or is there a specific problem you’re encountering during the process?
If you’re actually submitting the form by hitting a button, that won’t work; you’ll send a request to the server, which will load the page with your content. You’ll want to hijack the button’s onclick, and run the AJAX from there, as in the StackOverflow post I pointed to.
sort of true. You can use a submit button to send ajax, and you can use the submit event to do it, you just have to preventDefault to stop the browser from also submitting the form.