I'm using AJAX to retrieve data from MYSQL database through PHP.
However, if there is no result found, the variable still has two spaces. I found the problem using alert(data.length);
. The result is 2, which means there are two spaces.
How can I remove these spaces so that if there is no result, I could display a message using if(data == ''){}
?
Thank you!