Answer the question
In order to leave comments, you need to log in
How to pass nested array via ajax?
there is an array in php with a nesting of the form:
[
'f1' => 'ssss',
'f2' => 'sss2'
'f' => [
'11'=>'ww',
'www'=>'wcec'
]
]
$.post(
url,
{f1:'ww',f2:'ww'},
function(data){
// тут не важно
}
);
Answer the question
In order to leave comments, you need to log in
<?php
$arr=[
'f1' => 'ssss',
'f2' => 'sss2',
'f' => [
'11'=>'ww',
'www'=>'wcec'
]
];
echo json_encode($arr);
{"f1":"ssss","f2":"sss2","f":{"11":"ww","www":"wcec"}}
Normally serialize() on the form does this for you, but in AJAX just pass serialize as parameters
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question