[英]mootools form json post request
i want to to a request.JSON
on a dynamic form. 我想在动态表单上使用
request.JSON
。
is it possible to POST the complete form via a form id ? 是否可以通过表单ID发布完整的表单?
<table>
<form id="form">
<tr>
<td>username</td>
<td><input type="text" id="username"></td>
</tr>
<tr>
<td>password</td>
<td><input type="password" id="password"/></td>
</tr>
<tr>
<td></td>
<td><input type="submit" id="go" value="go"/></td>
</tr>
</table>
and on the script side: 在脚本方面:
$('go').addEvent('click',function( event )
{
event.stop();
var myForm = document.id('form');
var request= new Request.JSON (
{
url: 'check_login.php',
method: 'post',
data:
{
form: myForm
},
onSuccess: function( response )
{
if ( response.status )
{
document.location = "home.php"
}
else
{
$('response').addClass('error');
$('response').set('html', response.message);
}
},
});
request.send();
and in the php script i want to check via the $_POST variable. 在PHP脚本中,我想通过$ _POST变量进行检查。 but i cannot find a method to do it like this.
但是我找不到这样的方法。 actually im gettinh nothing.
实际上我什么也没得到。
greetz 格里茨
Sure, look at this link where it shows how to do it: 当然,请查看此链接,其中显示了如何执行此操作:
http://demos111.mootools.net/Ajax.Form http://demos111.mootools.net/Ajax.Form
It basically selects the form via your ID, add a listener to submit event and when it comes it sends all the form the way you are looking for :-) 它基本上是通过您的ID选择表单,添加一个侦听器来提交事件,并在它到达时将所有表单发送给您寻找的方式:-)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.