Search for a username
How would I write this code to check for an empty response?
Catch up wih the Appery.io community on our forum. Here you'll find information on the lastest questions and issues Appery.io developers are discussing.
https://forum.appery.io/
How would I write this code to check for an empty response?
http://docs.appery.io/documentation/a...
The 'data' object has the data returned. Check out jQuery docs to see what's inside that object.
I am still not figuring this out on how to validate if the response if empty.
If (response is empty)
invoke service
else
do something else
is (response is empty) an actual condition that can be tested or is there another way to get the response from the server? the service is called get_friend, how do I get the response so I can test if it is empty?
On service's complete event you can run this:
var res = jqXHR.responseText;
if (res == "")
// do something
else
// do something else
Thanks Max! Just an FYI checking if it was blank by just doing "" didn't work. I had to check if the response text was "[]" for it to work. Evidently the square brackets are part of the text response.