I have an ajax call which sends data like this:
$.ajax({
type:'POST',
url:URL
data:{'fexx': $('#form').serialize()},
....
And to parse that data in php controller (i'm using Codeigniter) I recieve it like this:
parse_str($this->input->post('fexx'), $arr);
When I print the content of $arr it brings info like this:
Array
(
[message_hello] =>
[hel] =>
)
Instead of showing it like this:
Array
(
[message] => hello
[help] => 0
)
Do you know the reason for this behavior? Thanks in advance!
You are mixing methods here. If you serialize the form data then you don't supply it in key value pairs. Serialize does that for you.
data:{'fexx': $('#form').serialize()},
Try this and modify your php to suit, or remove the serialize and specify each key => value individually
data: $('#form').serialize(),