How do I want to post a form using
jquery serialize function? I tried to post the form value but on the php part, the value is not shown. Below are my codes:
Active2 years, 6 months ago
You can create an auxiliar form using jQuery with the content of another form and then add thath form other params so you only have to serialize it in the ajax call. Solutions - jQuery. To prevent the double-serialization of your form data, acquire it as an array of key/value pairs instead of a serialized string by invoking jQuery's.serializeArray method on the form element instead of.serialize.
html
jQuery
PHP
If I console.log(data), I get: AmranAmran
id_staff=12345&sort=1
Jquery Serialize Form Post Data
30711 gold badge33 silver badges2020 bronze badges
3 Answers
Your server is receiving a string that looks something like this (which it should if you're using jQuery serialize()):
..something like this is probably all you need:
$params should then be an array that contains all the form element as indexes Https www.toyota.com 2011 prius owners manual.
19.4k11 gold badge2323 silver badges4545 bronze badges
If you are using
.serialize , you can get rid of this: Windows phone keyboard for android download.
You data will be available as follows with
.serialize :
It should be:
On PHP side you simple need to access it using the
$_GET['sort'] .
Edit:
To view the data, you should define a div with id
result so that the result returned is displayed within this div.
Example:
Hyder B.Hyder B.
5,57311 gold badge3030 silver badges3636 bronze badges
I am able to do it this way:
jQuery
PHP
Do give a comment if it need improvement or better solution.
AmranAmran
30711 gold badge33 silver badges2020 bronze badges
Not the answer you're looking for? Browse other questions tagged phpjqueryhtml or ask your own question.
Active12 days ago
Is it possible to send form elements (serialized with
.serialize() method) and other parameters with a single AJAX request?
Example:
If not what's the best way to submit a form together with other parameters?
Thanks
informatik01
13.6k88 gold badges5858 silver badges9494 bronze badges
KenavRKenavR
1,51377 gold badges2525 silver badges3939 bronze badges
8 Answersserialize() effectively turns the form values into a valid querystring, as such you can simply append to the string:
265k3131 gold badges226226 silver badges261261 bronze badges
Alternatively you could use
form.serialize() with $.param(object) if you store your params in some object variable. The usage would be:
See http://api.jquery.com/jQuery.param for further reference.
Hassaan
5,45444 gold badges1818 silver badges4040 bronze badges
kliszaqkliszaq
I dont know but none of the above worked for me, Then i used this and it worked :
In form's serialized array it is stored as key value pair
We pushed the new value or values here in form variable and then we can pass this variable directly now.
Rohit AroraRohit Arora
1,82322 gold badges1919 silver badges3838 bronze badges
If you want to send data with form serialize you may try this
43028364302836
You can create an auxiliar form using jQuery with the content of another form and then add thath form other params so you only have to serialize it in the ajax call.
FelixukoFelixuko
showdev
22.2k1515 gold badges3939 silver badges5959 bronze badges
SanjaySanjay
I fix the problem with under statement ;send data with url same GET methode
Serialize Array Jquery Form PostHassaan
5,45444 gold badges1818 silver badges4040 bronze badges
Ajax Serialize Form Data
Aziz FazliAziz Fazli
You can also use serializeArray function to do the same.
Jquery Post Form Serialize File Upload
Suresh PrajapatSuresh Prajapat
Jquery Serialize Form Post OfficeNot the answer you're looking for? Browse other questions tagged jqueryajaxformsserialization or ask your own question.Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |