带有序列化和额外数据的jQuery post() [英] jQuery post() with serialize and extra data
本文介绍了带有序列化和额外数据的jQuery post()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
好的,所以我试图找出是否可以发布序列化()和表格之外的其他数据。
Okay, so I'm trying to find out if it's possible to post serialize() and other data that's outside the form.
这是我的工作,但它只发送'wordlist'而不是表格数据。
Here's what I though would work, but it only sends 'wordlist' and not the form data.
$.post("page.php",( $('#myForm').serialize(), { 'wordlist': wordlist }));
任何人有什么想法吗?
推荐答案
您可以使用 serializeArray
[docs] 并添加其他数据:
You can use serializeArray
[docs] and add the additional data:
var data = $('#myForm').serializeArray();
data.push({name: 'wordlist', value: wordlist});
$.post("page.php", data);
这篇关于带有序列化和额外数据的jQuery post()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文