0
我有一个场景,我必须将ext textfield的用户名和密码值传递给控制器操作才能对数据库进行验证。我写了下面的代码将ext文本框值传递给javascript,然后传递给控制器操作
<ext:TextField Name="Username" runat="server" ID="UserName"></ext:TextField>
<ext:TextField Name="Password" runat="server" ID="Password"></ext:TextField>
<ext:Button runat="server" ID="submit1" Type="Submit" Text="LOGIN" >
<Listeners>
<Click Fn="CallLogin">
</Click>
</Listeners>
</ext:Button>
功能CallLogin(){
var username = document.getElementById('UserName').value;
var password = document.getElementById('Password').value;
//var url = '@Url.Action("Login", "Index")';
//window.location.href = url;
window.location.href = '/Login/Index/';
}
我如何通过这些值来控制行动?
谢谢!
嗨懒鬼..谢谢你的答复..但是当我尝试你的代码..按钮不提交给控制器oller.as这样的网页不提交..当我在IE浏览器尝试相同的..它发射一个错误,说$是未申报..任何想法为什么? – Philomath
你需要在你的页面中包含jQuery库以使其工作。查看我的修改回答 – Sharun
我已将以下代码添加到我的aspx文件..但是代码工作正如预期只在mozilla – Philomath