与序列化表格数据一起发布其他数据 [英] Posting additional data alongside serialized form data

查看:75
本文介绍了与序列化表格数据一起发布其他数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将一些其他数据与从用户表单输入中获得的序列化数据一起发布.

I want to post some additional data alongside serialized data i got from user form input.

例如,

$.post('update.php', $("#theform").serialize(),{cposition:swidget}, function(data) {

});

这不会发布其他帖子.我应该如何发布其他数据?.

This does not post the additional post.How am i supposed to post the additional data?.

推荐答案

jQuery serialize函数以&key=value格式产生其值.它在内部使用$.param执行此操作.您将可以通过相同的方式附加自己的值:

The jQuery serialize function yields its values in the &key=value format. It does this using $.param internally. You would be able to append your own values in the same manner:

$.post('update.php', [$('#theform').serialize(), $.param({cposition:swidget})].join('&'), function(data) { ... });

这篇关于与序列化表格数据一起发布其他数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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