7
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

form.serializeArrayで作った配列からnameをkeyにした連想配列に入れ替える

Last updated at Posted at 2016-06-07
form.js
    var $form = $("#js-signup-form");
    var serialize = $form.serializeArray();
    var post_data = {};
    // 配列 -> 連想配列に
    for (idx in serialize) {
      var key   = serialize[idx]["name"];
      var value = serialize[idx]["value"];
      post_data[key] = value;
    }
7
12
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
7
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?