的jquery form.serialize等参数 [英] jquery form.serialize and other parameters

查看:139
本文介绍了的jquery form.serialize等参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以发送一个 form.serialize()对象和其他paramters有一个 $。阿贾克斯()要求?

Is it possible to send a form.serialize() object and other paramters with a single $.ajax() request?

例如:

$.ajax({
    type : 'POST',
    url : 'url',
    data : {
        $('#form').serialize(),
        par1 : 1,
        par2 : '2',
        par3: 232
    }
}

如果不是出了什么与其他参数一起提交表单的最好方式。

If not what's the best way to submit a form together with other parameters.

感谢

推荐答案

连载()有效地把表单值成有效的查询字符串,因此你可以简单地追加到字符串:

serialize() effectively turns the form values into a valid querystring, as such you can simply append to the string:

$.ajax({
    type : 'POST',
    url : 'url',
    data : $('#form').serialize() + "&par1=1&par2=2&par3=232"
}

这篇关于的jquery form.serialize等参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆