Questions tagged [serializearray]

79 questions
33
votes
5 answers

jQuery serializeArray() add another value on top for passing to Ajax

I'm doing the following: var data = $(form).serializeArray(); // Now I want to add another value on this data data.username = 'this is username'; I want to know how can I add another value after doing serializeArray(). I tried all the things I…
Basit
  • 16,316
  • 31
  • 93
  • 154
32
votes
1 answer

What's the difference between .serialize() and .serializeArray()?

I'm experimenting with sending a form to a controller. jQuery documentation says that .serializeArray() should send a json array, and .serialize() should create a query string. However, when I try it, and inspecting with IE9 F12-mode, it looks like…
kaze
  • 4,299
  • 12
  • 53
  • 74
31
votes
8 answers

How do I access values created by serializeArray in JQuery?

I have this HTML:
And I create an object array from it like this: var dataArray = $("#myform").serializeArray(); Now how do I access 'title' in dataArray? This does not…
bart
  • 14,958
  • 21
  • 75
  • 105
7
votes
2 answers

jQuery serializeArray not picking up dynamically created form elements

I've got a form that's dynamically created using ajax (as data for the form elements has to come from a database) and I want to serialize the elements of the form to submit by ajax. I'm currently just testing my theory using code from the jQuery…
Cydaps
  • 167
  • 1
  • 3
  • 11
7
votes
8 answers

How to get the POST values from serializeArray in PHP?

I am trying this new method I've seen serializeArray(). //with ajax var data = $("#form :input").serializeArray(); post_var = {'action': 'process', 'data': data }; $.ajax({.....etc So I get these key value pairs, but how do I access them with…
Richard
  • 4,516
  • 11
  • 60
  • 87
6
votes
1 answer

jQuery/Ajax does not get submit button name

I am struggling with form submit using multiple submit buttons in the form. I know that the submit button name is not serialized, but I need to pass that name to the processing script. Sample code:
seedhom
  • 349
  • 2
  • 6
  • 19
5
votes
1 answer

posting jquery .serializeArray(); output through ajax

Quick question If I have serialized a form using jquery's .serializeArray(); function do I need to do anything to it before I can send it off using jquery's ajax data:? e.g. can I send off [{name: inp1, value: 'val1'}, {name: inp2, value: 'val2'}]…
Hailwood
  • 89,623
  • 107
  • 270
  • 423
4
votes
4 answers

Using serializeArray for non-form objects?

I'm trying to post some data built from some non-form elements but I can't seem to crack it. How can I create an array in the same format as serializeArray() does with form fields? I've tried several variations on this but it only picks up the last…
v3nt
  • 2,845
  • 6
  • 36
  • 50
4
votes
1 answer

Exclude multiple inputs from serializeArray

I have a form with some inputs, selects, and checkboxes. I am unable to exclude the items with class "not_included" in my serialized Array. var dataArray = $("#split_form").not(".not_included").serializeArray(); This still is serializing the fields…
626
  • 1,159
  • 2
  • 16
  • 27
3
votes
2 answers

can we get id from multiple elements having same name using serialize array

I have a form with same name but different ids.I am able to serializearray , but unable to get current id.
Ullas Prabhakar
  • 416
  • 2
  • 10
  • 24
2
votes
2 answers

Create nested object from serializeArray

I'd like to create this structure: { "officine_type": "Pharmacie", "officine_value": 2002626, "declared_lines": [ { "ean": 3578835501148, "qty": 1 …
Zac
  • 121
  • 2
  • 10
2
votes
3 answers

Two variables passed to a function, one's undefined?

Where I got stuck: In my spare time I work on a private website. My self-teaching is really unstructured, and I've run up against a huge hole in my fundamentals. I'm looking at a jQuery example from the jQuery API website, serializeArray, and I…
worc
  • 3,654
  • 3
  • 31
  • 35
2
votes
2 answers

jquery - serializeArray() error

im trying to pass an array as a string $(document).ready(function(){ var args = {}; $('.radio').click(function(){ var ob = $(this).siblings('select'); $('#uploader-wrapper').html(pre_load()); …
Phil Jackson
  • 10,238
  • 23
  • 96
  • 130
2
votes
3 answers

posting a single dimenstion array to db ajax post

I have this form, that loads the details using jquery load function here is the form
Yoweli Kachala
  • 423
  • 6
  • 13
2
votes
2 answers

Jquery - SerializeArray() by ID

I have this problem, I use serializearray() jquery for serialize all fields of Form to Json. It works fine if in the input I put the name attribute, but if I'd like to put only the ID attribute It doesn't work. The good function by name [name is…
Shinigami
  • 1,015
  • 2
  • 15
  • 23
1
2 3 4 5 6