【发布时间】:2011-12-28 19:27:03
【问题描述】:
我正在尝试学习 Prototype,所以我拼凑了一个简单的登录页面,其中包含用户名和密码字段以及一个登录按钮。
我有一个控制器类,我想在其中放置我的所有 onclick 函数。
function Controller()
{
this.logIn = function(){
this.username = Field.getValue("username");
this.password = Field.getValue("password");
this.logInResults = function (response){
alert(response.responseText);
}
new Ajax.Request("../../php/tis/LogIn.php",
{
method:'get',
parameters: {username: this.username, password: this.password},
onComplete: this.logInResults
});
}
}
然而,当我单击附加了登录功能的按钮时,发送了 HTTP 请求,但返回一个空响应字符串。当我手动点击 php 页面的链接时,它就在那里,并且按预期运行。
Firebug 显示如下:
GET http://localhost/AJAXSeedOrder/php/tis/LogIn.php?username=User%20Name&password=
Firebug cannot find _firebugConsole element true Window tis?username=User+Name
Firebug cannot find _firebugConsole element true Window tis?username=User+Name
Firebug cannot find _firebugConsole element true Window tis?username=User+Name
我完全不知所措 - 任何帮助将不胜感激。
【问题讨论】: