Reputation: 105
The following jquery codes alert the 123 twice.
jQuery(document).ready(function(){
jQuery('form').submit(function(e){
e.preventDefault();
var _product_id = 123;
alert(_product_id);
});
});
the form
<form action="" method="POST" enctype="multipart/form-data" id="f-1" class="single-product-editor-form">
<span>
<button class="single-edit" id="<?php echo $row_no; ?>" type="submit">ویرایش</button>
</span>
</form>
where is problem?
Upvotes: 0
Views: 43
Reputation: 9537
Most likely, you loaded your script file twice, because the code looks fine to me. As you use PHP, it could be an accidental repeated include, so you end up with two script tags:
<script>
// your JavaScript code
</script>
<script>
// your JavaScript code
</script>
I did a little test:
Upvotes: 1