[eluser]otn3m3m[/eluser]
I am using simplemodal dialog. The main view commits ajax post to the controller to recieve the text for the dialog.
Problem is when i press the submit button in the dialog, for some reason it submits the form twice. I know this because the page does two alerts ("Event text").
Why is it submitting twice and how can i fix it?
thanks,
main view
Code:
<html>
<head>
<!-- jquery and simplemodal scripts --!>
</head>
<body>
<a href='#'>New</a>
script
function new_project(){
$.post('http://localhost:8080/pm/index.php/project/get_dg_new_project', {}, function callback(response) {
$(response).modal();
});
}
script
</body>
</html>
Dialog view
Code:
<div id='basic-modal'><h2>Basic Modal Dialog</h2>
<h1>SimpleModal</h1>
<form id="target" action="destination.html">
<input type="text" value="Hello there" />
<input type="submit" value="Go" />
</form>
script
$('#target').submit(function() {
alert('Event text');
return false;
});
script
</div>