ユーザーフォーム入力から取得したシリアル化されたデータと一緒に、いくつかの追加データを投稿したいと思います。
例えば、
$.post('update.php', $("#theform").serialize(),{cposition:swidget}, function(data) {
});
これは追加投稿を投稿しません。追加データを投稿するにはどうすればよいですか?
ユーザーフォーム入力から取得したシリアル化されたデータと一緒に、いくつかの追加データを投稿したいと思います。
例えば、
$.post('update.php', $("#theform").serialize(),{cposition:swidget}, function(data) {
});
これは追加投稿を投稿しません。追加データを投稿するにはどうすればよいですか?
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) { ... });
    シリアル化された文字列の末尾に何かを追加できます。
$.post('update.php', $("#theform").serialize() + '&cposition:swidget', function(data) {
});
    できるよ:
var data = $('#theform').serializeArray();
data.push({cposition: swidget});
//then
$.post('update.php', data, function(data) {
});