【发布时间】:2013-07-05 18:51:45
【问题描述】:
好吧,当用户单击它时,我有一个按钮,它被禁用并淡入淡出在一条消息中谢谢我们会尽快解决这个问题 但现在我想要做的是,当用户点击按钮时,它将禁用,然后它将发布到一个 php 文件(比如:error.php),这个 error.php 将是这样的
<?php
if(isset($_POST['submit'])){
$ip= $_SERVER['REMOTE_ADDR'];
$page= $_SERVER['REQUEST_URI'];
// now update these to sql database ..... and if successfully posted return true
}
else{
return false;
}
现在,如果 jQuery 为 True,它将在 div 中显示成功消息 否则它将在另一个 div 中消失并显示错误/抱歉消息
html 和 JS 是这样的
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("#submit").click(function(){
$('#submit').attr('disabled',true);
$("#div1").fadeIn(1000); //if success
$("#div2").fadeIn(1000); //if error
});
});
</script>
</head>
<body>
<div id="div1" style="display:none;">Success</div>
<div id="div2" style="display:none;">Error</div>
<button id="submit">report The Page</button>
</body>
</html>
请帮忙 谢谢
【问题讨论】:
-
你在哪里
<form>?也可以试试<input type="submit">