Answer the question
In order to leave comments, you need to log in
How to get data from Ajax POST json in PHP?
There is Ajax sending:
$.ajax({
type: 'POST',
dataType: 'JSON',
url: '/apiw/',
data: this.data,
cache: false,
context: this
})
JSON.stringify({
controller: 'controller',
action: 'action',
jsonContent: true,
});
{"ct":"5cd5ElvHhiXAQjHvv9xDz1VQRB6UWPPYwYRrskarxm65nGXvrVgjjhg9kSbO7Ec3/Lu/0zpyByhDG1odMbdiruubx5Yfc4oqQSN7scKr0mo:","iv":"b2e7d5affc491a76d507c2e26820b5f6","s":"a94bf91b838c94e7"}
Answer the question
In order to leave comments, you need to log in
It’s not very clear why such a twist with JSON.stringify, but it’s easier and more logical to do this:
this.data = {
controller: 'controller',
action: 'action',
jsonContent: true
};
$.post('/apiw/', this.data, function(data){
// в data будет объект, если вы в /apiw/ результатом вернёте JSON
}, 'json');
array(
'controller' => 'controller',
'action' => 'action',
'jsonContent' => true
);
this.data = {
controller: 'controller',
action: 'action',
jsonContent: true
};
$.post('/apiw/', {param_name: this.data}, function(data){
// в data будет объект, если вы в /apiw/ результатом вернёте JSON
}, 'json');
array(
'param_name' => array(
'controller' => 'controller',
'action' => 'action',
'jsonContent' => true
)
);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question