Hi to all
I got the following problem
I want to send to PHP server nested json using ajax.
{item1:'one',
item2:'eeee',
item3:[{item31:'sdf',
          item32:'sdfs'}]
}


My code:
                                     $.ajax({
                                url: "translation_edit.php",
                                type: "post",

                                data: {item1:'one',item2:'eeee',item3:
[{item31:'sdf',item32:'sdfs'}]},
                                 success: function(data) {
                                        alert('Success');},
                                complete: function () {
                                        alert('Complete');
                                },
                                error: function (xhr, ajaxOptions, thrownError){
                            alert(xhr.valueOf());
                                }
                        });

But result on server(PHP) is as follows:
Array
(
    [item1] => one
    [item2] => eeee
    [item3] => [object Object]
)

My code on PHP server:
<?php
$handle = fopen("data.txt", "w");
fwrite($handle, print_r($_POST,true));
fclose($handle);
?>

How to get rid of [object Object] and get item31 and item32?

Greetings
Majkel

Reply via email to