Answer the question
In order to leave comments, you need to log in
In what form to accept Ajax server responses?
In what form to accept AJax server responses?
For example:
when registering, when checking the E-mail address and login for "uniqueness" - an error: there is already an account for this address and this login is already taken. What is the right way to report it? Possible server responses :
"error_check_email|error_check_login"
And then split in places where there is "|" and check values, look for errors?
OR
"l:1|e:1"
l - login
e - E-mail
0 - verification passed
1 - error
Thus, login(l):error(1)
and split it all into an array.
Or are there smarter options?
Answer the question
In order to leave comments, you need to log in
On server:
$result=[
'vals'=>'hello',
'some_else'=>'world'
];
echo json_encode($result);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question