Felix
Felix

Reputation: 5629

Accessing array in php which is passed from ajax

I pass a JSON array to a PHP function with ajax like this:

 $.ajax({ url: 'php/processing.php',
                data: {action: 'orderLater', kundenDatenArray: kundenDaten},
                type: 'post',
                success: function(output) {
                    alert(output);
                }
            });

and now I want to generate a PDF out of this so I have to access the array in PHP.

I tried this:

function sendLater($in){

    $filename = "../pdfs/".$in[0]->vorname."_".$in["nachname"].".pdf";
    echo var_dump($in);
    //echo $filename;
    exit();

the $in var looks like this when I do var_dump

enter image description here

how do I access the array:

$in[0]->vorname

$in["nachname"]

$in[0]["nachname"]

non of these are working ...

Upvotes: 0

Views: 52

Answers (1)

Claudio King
Claudio King

Reputation: 1616

$in["nachname"] must return 'u', it is the right syntax.

Upvotes: 1

Related Questions