[SOLVED] Get Submit Button Value

[SOLVED] Get Submit Button Value

Hi all,

I'm new here - but not new to the web.

I have a question about getting the value of a submit button using jQuery's .submit() to initiate a .ajax().

I need to do this because the application I'm working on has multiple submit buttons - and the script on the receiving end will be doing different functions based on which submit button is clicked - ie - Reset, Apply, Apply & Save, Commit. Like so:

<input name='update' type='submit' value=' Reset '>
<input name='update' type='submit' value=' Apply '>
<input name='update' type='submit' value=' Apply & Save '>
<input name='update' type='submit' value=' Commit '>


I tried adding class names - and using this kind of an approach:

$("input").click(function(){
if( $(this).is("apply")) {
var update=' Apply ';
} else if( $(this).is("applyandsave")) {
var update=' Apply & Save ';
} else if( $(this).is("reset")) {
var update=' Reset ';
}
});

But then the page was refreshing - canceling out the whole reason we are using AJAX.


I can post all my code - but am curious to see if anyone else has ran into this issue and how you solved it.


Thanks