[jQuery] Ajax processData
Hello all
I am trying to do an ajax call passing a json to the server. My call
is like this:
$.ajax({
type: "POST",
url: "/myurl.php",
processData: false,
contentType: "application/json",
data: {
"data1": "data 1",
"data2": "data 2",
"data3": "data 3"
},
dataType: "text"
})
When i set processData to false, i can't retrieve the data -
({data1, ...}) I passed to my php file. When i set it to true, I can,
but I have a string instead of a json. For retrieving this data I am
using a function that reads the body of the request.
My question is: Is it possible to pass a json to the server in the
body of my request? And if it is, how can I do it and what is wrong in
my code?
Thanks
Dani