On Sunday 08 February 2009, pedalpete wrote:
> Sorry Tim, I didn't understand it that way.
:-)
> You should still be able to do this fairly simply.
Looks like I will also have to use a wrapper to get the form
using the 'this' keyword, since I work with multiple forms.
I think I can get what I need by something like this:
Illustrated by:
function CheckForm(f) { // triggered by onsubmit="CheckForm(this);"
var formname = f.name;
var url = f.action;
var meth = f.method;
// illustrated by
alert('Action: ' + f.action + '\nMethod ' + f.method + "\nName: " +
f.name);
// I'll review your examples, this gives me a start
// more code ......
return false;
}
//Thanks
//tim
> You don't have to specify the url, you can pass it as a variable.
> But you would need to put your $.ajax function into another function,
> and call it when clicked. You can also build the data variables in the
> other functions.
>
> For instance
> [code]
> $('form#1').submit(function(){
> var url=$('form#1).attr('action');
> // then get your data variables and do whatever you want to do with
> them
> var type= "get";
> submitForm(url, data);
>
> });
>
> function submitForm(url, data){
> $.ajax({
> type: type,
> url: url,
> data: data,
> success: function(){
>
> }
> })
>
> }
>
> [/code]
>
> I hope that helps, and that I understand what you were trying to do
> better than my first answer.