[英]I tried serialize() but doesnt seem to work ? what am I doing wrong?
I did this but not working 我这样做了但是没用
if(error.join()!="")
{
$("#sub_error").fadeTo(200,0.1,function()
{
$("#sub_error").html(error.join("<br/><br/>")).append('<br/>
<input type="button" name="err_ok" id="err_ok" value="ok">')
.addClass('subboxerror').fadeTo(900,1);
bindEvents();
});
function bindEvents()
{
$("#err_ok").click(function()
{
$("#sub_error").fadeTo(1000,0);
});
}
}
else
{
$("#frm_sub")
.removeClass().addClass('messagebox')
.text('Submitting...').fadeIn("slow");
$.post("register_user.php",
{
$('#frm1').serialize()
} ,
function(data)
{
alert(data);
});
});
}
Try: 尝试:
$.post("register_user.php", $('#theForm').serialize(), function(data) { //...
Edit: 编辑:
You should not be wrapping the return value of ('#frm1').serialize()
in curly braces. 你不应该捆绑的返回值
('#frm1').serialize()
大括号内。 The return value of serialize is a string, which the post() call will pass directly to the server. serialize的返回值是一个字符串,post()调用会将它直接传递给服务器。
如果输入元素来自表单,则可以使用serialize方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.