0
我有一个模块列表,它检索数据库中所有可用的模块。列出的每个模块将包含一个“订阅”按钮。当用户在没有登录的情况下单击按钮时,会弹出一个登录窗口,要求他/她在订阅该模块之前登录。使用AJAX传递信息
我需要在这里实现什么是从用户发送的输入到服务器,验证用户并登录了他,但我有当用户输入不会被传递到正确的PHP文件有问题在服务器。
module.php:
<div id="login-form" title="Sign In">
<p class="validateTips">Please sign in to continue.</p>
<form>
<fieldset>
<label for="username">Username</label>
<input type="text" name="username" id="username" class="text ui-widget-content ui-corner-all" />
<label for="password">Password</label>
<input type="password" name="password" id="password" value="" class="text ui-widget-content ui-corner-all" />
<button id="login-button">Login</button>
</fieldset>
</form>
</div>
module.js:
$(document).ready(function() {
$("#login-button").click(function() {
var post_username = $("#username").val();
var post_password = $("#password").val();
$.post("validate.php", {
username: post_username,
password: post_password
});
});
$("#login-form").dialog({
autoOpen: false,
height: 300,
width: 350,
modal: true,
buttons: {
Cancel: function() {
$(this).dialog("close");
}
},
close: function() {
$(this).dialog("close");
}
});
$(".subscribe").click(function() {
$("#login-form").dialog("open");
});
});
validate.php:
$username = $_REQUEST["username"];
$password = $_REQUEST["password"];
// php verification code goes here…
现在的问题为t他用户输入未通过validate.php。相反,输入附加在module.php的末尾。我想这个问题是由于AJAX后,但不幸的是,我仍然无法弄清楚。任何人都可以在这里发光
对不起,我犯了一个错误在我的问题。我确实指定了正确的文件名,但输入仍然传递到module.php所在的页面上。 – SCC