Javascript 如何将输入参数从j query对话框传递到asp.net中的处理程序文件(.ashx)
嗨,伙计们!!! 我有一个带有两个输入参数的jquery对话框,它是Javascript 如何将输入参数从j query对话框传递到asp.net中的处理程序文件(.ashx),javascript,jquery,asp.net,ajax,Javascript,Jquery,Asp.net,Ajax,嗨,伙计们!!! 我有一个带有两个输入参数的jquery对话框,它是 <div id="dialog" title="Login"> <form action="" method="POST" id="loginForm"> Username: <input type="text" name="username" /><br/> Password: <input type="password" name="password"
<div id="dialog" title="Login">
<form action="" method="POST" id="loginForm">
Username: <input type="text" name="username" /><br/>
Password: <input type="password" name="password" />
</form> </div>
现在我有了一个处理程序(.ashx)文件,我需要在其中访问用户名和密码的值…在这种情况下,Plz的人帮助我如何将输入参数作为URL发送
我们将非常感谢您的帮助。。。
提前感谢…您不必在模式上创建提交按钮。您可以在表单中使用
。至于您的答案,只需将方法更改为“get”
<div id="dialog" title="Login">
<form action="pathToYourHandlerFile" method="GET" id="loginForm">
Username: <input type="text" name="username" /><br/>
Password: <input type="password" name="password" />
</form> </div>
用户名:
密码:
我经常通过ajax使用ashx处理程序。
模式如下:
$.ajax({
url: 'url/to/the/handler.ashx',
data: { 'param1':'param1Value', 'param2':'param2Value' },
success: function (data) {
/* process the response data here */
}
});
在您的情况下,您必须传递用户名和密码值。form
method=“get”
?@abhitalks谢谢您的回复…但是我需要在上面提到的代码中添加带有参数的URL…
$.ajax({
url: 'url/to/the/handler.ashx',
data: { 'param1':'param1Value', 'param2':'param2Value' },
success: function (data) {
/* process the response data here */
}
});