在网站上工作时,我有一个内容区域部门,我想根据单击的图像更新其内容。现在,我有一个在内容区域中使用的自定义滚动条。现在,起初我为 onclick 脚本函数编写了以下代码段:
function xyz(){
$("#content-area").load("abc.php");
$("#content-area").mCustomScrollbar({scrollButtons:{enable:true}});
}
但是脚本的第二行没有响应,即我没有得到滚动条。相反,当我使用这段代码片段时,它起作用了:
$.post("abc.php", function(data){
$("#content-area").html(data);
$("#content-area").mCustomScrollbar({scrollButtons:{enable:true}});
});
我想知道 $.post() 的功能以及为什么第一个片段不起作用而第二个片段起作用?