How can I send a nested object via POST request?
var name = "test",
path = "?diffCurr%5B%5D=FALSE&diffProv%5B%5D=FALSE",
data = {
datatype:"report",
"value":{
"name":name,
"query":path
}
};
$.ajax({
type:"POST",
url: "resources/savedata.html",
data: data,
success: function(data){
...
},
complete: function(){
...
}
})
When I check in the chrome, in the network tab under "form data", I see this:
datatype:report
value[name]:test
value[query]:?diffCurr%5B%5D=FALSE&diffProv%5B%5D=FALSE
Basically, I was expecting $_POST["value"]
to contain an object with name
and query
.