[jQuery] Problem with double submit of and form
Hello,
the code bellow shows my problem. I have a link, when i click on this
link
the DIV with the Form slide in. This works.
But when I submit the form the result was executed twice. And I Don't
know why.
When I leave the code for slide in the form, the form was submited
only once.
Why jQuery submited this form twice??? Any idea?
<a href="javascript:void(0)" id="testlink">Show Test</a>
<div id="tpanlegen" style="width: 100%; display: none;">
<form id="teilprojekt_create" action="/test.action" method="post">
<select name="test" id="test" class="textfeld" style="width:
100%;">
<option value="1950">Test 1</option>
<option value="2000">Test 2</option>
</select>
<input id="tpcsubmit" value="Submit" type="submit">
<script type="text/javascript">
$(document).ready(function () {
var optionstpcsubmit = {
beforeSubmit: before_tpcsubmit,
success: complete_tpcsubmit,
timeout: 3000,
target: '#target'
};
$('#tpcsubmit').closest("form").submit(function() {
$(this).ajaxSubmit(optionstpcsubmit);
return false;
});
function before_tpcsubmit() {
$('#inicator').show();
}
function complete_tpcsubmit() {
$('#inicator').hide();
$("#target").effect("slide",{ },2000);
}
});
</script>
</form>
</div>
<script type="text/javascript">
$(document).ready(function () {
$('#testlink').bind(
'click',
function(e){
$("#tpanlegen").effect("slide",{ },2000
);
});
});
</script>
Best Regards
Johannes Geppert
-------------------------------------------------
web: http://www.jgeppert.com
twitter: http://twitter.com/jogep