Im not sure if this belongs to a jquery or PHP forum depending on which area Im screwing up!
I have an AJAX call in jquery that submits the POST data from a from using jquery’s form.seralize() method to a php file.
I am returning the values from the php file like this:
<?php
$str = json_encode($_POST);
echo $str;
I am looping through the data returned from the PHP file in my jquery like this:
$.post(‘php_file.php’, $this.serialize(), function(data){
$.each(data, function(key, value){
$(‘#result_two’).append(‘<p>’+key+‘</p><p>’+value+‘</p>’);
});
But instead of looping through each key:value pair, it loops through each letter arggghhhh what I’m I doing wrong?
I think Ive got the data as a string and not an object? Very confused