Answer the question
In order to leave comments, you need to log in
How to pass multiple properties to a javascript object via echo in php?
Good evening, tell me how can I display several properties of a javaScript object via echo in php?
I send data to the server via ajax:
$.ajax({
url: "./form/formprocessor.php",
type: 'POST',
data: payload,
dataType: 'json',
crossDomain: true
}).done(function() {
data.success = true;
afterSubmit(data);
}).fail(function() {
afterSubmit(data);
});
Answer the question
In order to leave comments, you need to log in
$response = [
'success' => true,
'CaptchaError' => false,
];
echo json_encode($response);
// старый синтаксис
$response = array(
'success' => true,
'CaptchaError' => false,
);
echo json_encode($response);
echo '{
"success" : true,
"CaptchaError" : false
}';
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question