Javascript 我的负载消失得很快
这是我的.click代码,它使用ajax发布到数据库中,并显示和隐藏一些元素,现在我添加了将notification.php加载到div中的功能,但问题是,加载的notification.php大约在1秒内消失,除此之外,我还需要单击此按钮两次以显示notification.php,有什么建议吗Javascript 我的负载消失得很快,javascript,php,jquery,ajax,Javascript,Php,Jquery,Ajax,这是我的.click代码,它使用ajax发布到数据库中,并显示和隐藏一些元素,现在我添加了将notification.php加载到div中的功能,但问题是,加载的notification.php大约在1秒内消失,除此之外,我还需要单击此按钮两次以显示notification.php,有什么建议吗 $("#notifBtn").click(function() { var name = $(this).attr("name"); var dataString = 'name=' +
$("#notifBtn").click(function() {
var name = $(this).attr("name");
var dataString = 'name=' + name;
var parent2 = $(".notifalert");
$.ajax({
type: "POST",
url: "voting/addnotif.php",
data: dataString,
cache: false,
success: function (html) {
}
});
parent2.load("notification.php");
$("#newpost").show();
$(".thismenu").hide();
return false;
});
不知道我是否理解,但是使用$(“.thismenu”).hide('slow');不,使用show()hide(),一切都可以!主要问题是parent2.load(“notification.php”);它不应该是$parent2吗?@SeanKendle请参见第三个变量声明:)@user2784722是
文档中的上述代码。准备好了吗?你能给我们看一些相关的html吗?