This is my rough js
Click submit nothing, click again it submits, click again it submits twice,
again submits 3 times…you get the picture. And while its sent to the server
you can continue to click away adding to the requests in multiples.
Anyone see where I am going wrong here?
<script type="text/javascript">
$("#PromotionRequestForm").submit( function() {
promo("#PromotionRequestForm", "#promo")
//alert('clicked');
return false;
});
function promo(selector, target){
var $form = $(selector);
var $target = $(target);
$form.submit( function() {
var form_url = $form.attr('action');
var form_target = $(target);
var form_data = $form.formSerialize();
$form.ajaxSubmit({
type: "post",
url: form_url,
data: form_data,
dataType: 'json',
success: function(response){
if (response.status === true) {
alert(response.status);
} else {
alert(response.status);
}
}
});
return false;
});
};
</script>
From: Dave Maharaj [mailto:[email protected]]
Sent: September-20-10 2:52 PM
To: [email protected]
Subject: Prevent Ajax duplicate Submissions
I have googled and tried various bind unbind with no success. (Ajax
Submitted form)
e.preventDefault();
Sure all that’s is good stuff but something simple like
isSubmitted = false;
submit form
isSubmitted = true;
then while waiting for response if pressed again do nothing if submitted =
true
after response set isSubmitted back to false….
I simple need a way to prevent the form from being submitted once its been
submitted. I tried binding then next time its submitted its sent twice, then
three times. I know the UIBlock script but its not whats needed in this
case.
Any quick easy solutions anyone?
Check out the new CakePHP Questions site http://cakeqs.org and help others
with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en