LoginSignup
3
3

More than 5 years have passed since last update.

フォームに入力されたデータに任意のデータを付け加えてjQueryでPOSTする方法

Posted at

serializeArray()を使います。

配列にpushする際は[{name: "キーの名前", value: "キーの値"}]となるように注意しましょう。

data = $("form").serializeArray()
url  = $("form").attr('action')
data.push({name:'foo', value:'bar'})
$.post url, data
3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3