添加了表单submit botton的ID并删除了onSubmit事件:
echo \'<input type="hidden" value="\'.$return_survey_url.\'" id="return_url">\';
echo \'<form action="http://www.example.com/test.php" method="post" target="votar">\';
echo \'<textarea name="tweet" rows="8" cols="10" maxlength="130"></textarea>\';
echo \'<input type="submit" value="test" id="test"/>\';
echo \'<iframe name="votar" style="display:none;"></iframe>\';
echo \'</form>\';
在noconflict模式下添加了JS,并在单击submit按钮时调用了函数:
<script type="text/javascript">
jQuery(function($) {
// Code that uses jQuery\'s $ can follow here.
$( "#test" ).click(function() {
alert(\'some message\');
var return_url = document.getElementById(\'return_url\').value;
window.location.href= return_url;
});
});
</script>