AJAX form submision problem
Posted: Sun Nov 19, 2006 12:05 pm
feyd | Please use
Causes the form to get submitted. However, when I replace:
with:
The form then gets processed via AJAX as I intend. Why is that, and what can I do about it? Thanks in advance.
Dotan Cohen
http://what-is-what.com/what_is/ajax.html
feyd | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi all, I've got a form that I'd like to run through AJAX, using the Prototype library. However, whenever I try to run the form through Form.serialize() it gets submitted to the page specified in it's action attribute. For instance:
[syntax="javascript"]
function sendFeedback(e) {
// Update user interface
$('response').innerHTML = 'Adding email address...';
// Prepare query string and send AJAX request
var pars = Form.serialize(addressForm);
var myAjax = new Ajax.Updater('response', 'ajaxServer.php', {method: 'get', parameters: pars});
// Stop form from submitting when JavaScript is enabled
Event.stop(e);
}
Code: Select all
var pars = Form.serialize(addressForm);
Code: Select all
var pars = 'address=' + escape($F('address'))+'&address2=' + escape($F('address2'));
Dotan Cohen
http://what-is-what.com/what_is/ajax.html
feyd | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]