I am having a heck of time getting a form to both make an Ajax request and submit to the forms action parameter.
I have a script that is supposed to collect form data with http request, then submit through to paypal.
The function is setup as a submit event using Prototypes observe method.
When submit it clicked, the following is run.
Code:
function submitReg(formid) {
var form = formid.target;
var params = {};
params['first'] = $F('first');
params['last'] = $F('last');
params['email'] = $F('email');
//$(form).action = "https://www.paypal.com/cgi-bin/webscr";
var url = '/sendReg';
new Ajax.Request(url, {
method: 'post',
parameters: params,
onComplete: function(tran) {
alert('sent');
}
});
}
Problem is, the form just goes to the action parameter. If I set the form to false, it goes no where but the ajax request is made.
I cannot seem to figure this out and spent hours trying out different combos of inline handlers, returning false, returning true... Im going mad with this.
Any help would be huge!!
Thanks
Rich