Php mootools表单json post请求
我想在动态表单上创建一个Php mootools表单json post请求,php,javascript,html,mootools,Php,Javascript,Html,Mootools,我想在动态表单上创建一个request.JSON 是否可以通过表单id发布完整的表单 <table> <form id="form"> <tr> <td>username</td> <td><input type="text" id="username"></td> </tr> <tr>
request.JSON
是否可以通过表单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>
在php脚本中,我想通过$\u POST变量进行检查。
但我找不到这样的方法。事实上我什么也得不到
greetz当然,请查看此链接,其中显示了如何执行此操作: 它基本上是通过您的ID选择表单,添加一个监听器来提交事件,当事件发生时,它会以您想要的方式发送所有表单:-)
$('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();