We normally have to serialize the form to post the form data to Ajax controller. Jquery serialize will serialize the form data, so it will be like query string. Using $.post or $.get we can call the Ajax server. So here we will send the form data in serialized format.
How to get the jquery serialized data in php
It’s very normal, depends on ajax method (Post, Get) we will get the value $_POST[‘data’] or $_GET[‘data’]. Now we have data something similar to this.
$param = 'str1=value1&str2=value2';
How to extract the jquery serialized string in php
parse_str php function will parse the string into variables. So parse_str will help us extract the serialized string.
example:-
$param = 'str1=value1&str2=value2'; parse_str($param); print $str1; //value1 print $str2; //value2
Cheers 🙂