Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i fetch a single value from serialize()

Tags:

jquery

I have a form and i fetch the values of form using jQuery .serialize(); for example to fetch the form data i use the following.

var formData = $('form').serialize();

now the variable formData holds the following value.

subcategoryname=aaaa&prefix=AA&categoryid=1

from the above string i want to fetch only the value of categoryid i.e 1 here, how do i do it using jQuery?

like image 454
Ibrahim Azhar Armar Avatar asked Jan 24 '26 07:01

Ibrahim Azhar Armar


1 Answers

I think you should use .serializeArray() to make it as an object which makes it much easier to access.

like image 108
Pehmolelu Avatar answered Jan 26 '26 21:01

Pehmolelu