[jQuery] Disable Submit
[jQuery] Disable Submit
I have a form i am submitting via Ajax. So after submit while its waiting
for response i have my little spinner so user knows something is happening.
But how can i disable the submit while its "thinking" waiting for a response
so the user is not sitting there clicking submit over and over.
Using this for my js as of now;
$
'#new_set'
.live
'click', addRecord
;
function addRecord
{
var data = $
'#add'
.serialize
;
$
"#add"
.slideToggle
'fast'
;
$
'.flash'
.prepend
'<div class="saving"></div>'
;
//$
'#new_set'
.die
'click'
;
$.ajax
{
type: "post",
url: "/manage/awards/add",
data: data,
dataType: 'json',
success: function
response
{
if
response.status === true
{
alert
response.status
;
$
'.saving'
.remove
;
} else {
//$
'#new_set'
.live
'click'
;
alert
response.status
;
$
'.saving'
.remove
;
}
}
}
;
}
I tried adding $
'#new_set'
.die
'click'
; but then it never submitted.
Thanks
Dave