我尝试使用链接提交我的表单,但 ajax 不起作用:
<form id="store_relation" action="store_relation.php" method="post" name="store_relation" >
<input type="hidden" name="store_id" value="<?php echo $row['store_id']; ?>" />
<input type="hidden" name="user_id" value="<?php echo $row['id']; ?>" />
</form>
<li class="online_users"><a id="online_form"><?php echo $row['username']; ?></a></li>
<script type='text/javascript' language="javascript">
$(document).ready(function(){
$('#online_form').click(function(e) {
e.preventDefault(); // prevent the link's default behaviour
$('#store_relation').ajaxForm( {
success: function() {
alert('hey');
}
});
});
});
</script>