Well, sorry for my bad grammar, but any help will be much appreciated..
Ok, here I'm trying to encode string by using json inside PHP then using JavaScript to read the json string. It will have 2 cases here.
The first one is, the application will running normally, so does the encode. The json string will be like this :
{"employee":
[{"id":"1","firstName":"aaa","lastName":"abc","timeIn":"08:00:00","timeOut":"17:00:00"},
{"id":"2","firstName":"bbb","lastName":"def","timeIn":"08:00:00","timeOut":"16:45:00"}]}
and the second one is, the PHP can't read the MySQL database, so in PHP the json encode will be like this :
{"errorProcess":{"text":SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it. }}
The question is, in JavaScript how can I make an IF statement in JavaScript based on the result string in json?
Maybe it will be like this, but I don't know how to write it in JavaScript.
IF (in json string has employee){then result}
else if(in json string has errorProcess){then result}
Thanks for your help