I have a standard form on poll.php:
<form method="POST" action="createpoll.php">
..blah...
</form>
Is there anyway to process the form without leading the user to createpoll.php, something like calling createpoll.php on submit?
This technology is called AJAX. With help of JAvaScript libraries it's become really easy to use it. You can use JQuery or Prototype. Search for AJAX submission. There are a lot of answers on this topic - i.e., stackoverflow questions.
For exapmle, using JQuery method ajax() it looks like this(JavaScript):
$.ajax({
type: "GET", // method - Get or Post
url: "cart.php", // Url to send data
data: { addproduct: productIDVal, isAjax: 'true'}, // Parameters
success: function(theResponse) {
// code to operate with response, if the request was succesful.
// It can be string or array.
}
});
A great, extremely easy way to use Ajax in your form can be found here: http://jquery.malsup.com/form/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With