Answer the question
In order to leave comments, you need to log in
How to send JSON response instead of php redirect?
Hello, the situation is as follows, after submitting the forms, there is a redirect script
$this->response->redirect($this->url->link('information/contact/success'));
Answer the question
In order to leave comments, you need to log in
json code so that instead of a redirect, I would run a scriptJSON is an object , not a code , it is needed to transfer data , and a front-end script can already perform some actions based on this data .
$response->redirect()
, it $response->json()
's probably also.
Or, as Aleksey Ukolov said , or at the beginning of the action, indicate in the header that Json will be returned and simply return an array.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question