Answer the question
In order to leave comments, you need to log in
Why does passing json via pjax post create so many variables?
Hello!
I receive data from one service in the form of a json object. I do it in javascript'e
Then I want to transfer this data to the server via pjax. With the post method
When I do this, pjax creates its own variable for each key in the object.
As a result, if I pass suppose
var info = {
"id": 64479477,
"first_name": "Сергей",
"last_name": "Мишин",
"sex": 2,
"nickname": "",
"screen_name": "sergey_mishin",
"bdate": "6.6.1987"
}
$.pjax.reload({
container : '#content',
type : 'POST',
url : path,
data : info,
push : true,
replace : false,
timeout : 1000
});
info[id]:64479477
info[first_name]:Сергей
info[last_name]:Мишин
info[sex]:2
info[nickname]:
info[screen_name]:sergey_mishin
info[bdate]:6.6.1987
$.pjax.reload({
container: '#content',
type: 'POST',
url: path,
data: {
jsonData: JSON.stringify(data)
},
push: true,
replace: false,
timeout: 1000
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question