【发布时间】:2015-05-23 00:28:08
【问题描述】:
我试图在 WordPress 中进行简单的聊天,我需要使用 PHP 处理一些信息。为此,我的 HTML 中有一个按钮,当有人单击该按钮时,会调用一个 JavaScript 函数。这是 JavaScript:
function chatinitial(){
var user=document.getElementById("chatuser").value;
jQuery.post("./chat.php",{stage:"initial",user:user},function(data){
alert(data);
});
}
这似乎不起作用。我觉得这与我保存chat.php 文件的位置有关。现在我将它放在我的主题文件夹下,与编写我的 HTML 的 index.php 文件相同的目录。我怎样才能做到这一点?
【问题讨论】:
-
您需要为
.post()提供文件的有效相对或绝对路径。