I have ajax system installed. When a MySQL query does not return data, I need it to return an empty object. I create a node βdataβ in a PHP script, and even when the request does not return data, I pass $ data ['success'] = 1.
The trick is that I can't figure out how to check if a request was returned by data or not.
I tried...
// sub responseObj.data for responseObj.data[0] for the following if's if(responseObj.data[0].length == -1) if(responseObj.data[0] == null) if(responseObj == undefined) //edit: added this... if(!responseObj.data[0])
and I really lost my binding on any other snippet I tried.
EDIT: adding generated xml which is passed to my script
XML - returning null results
<response_myCallbackFunction> <success>1</success> <response_myCallbackFunction>
XML - return a populated request
<response_myCallbackFunction> <data> <random_data>this is data</random_data> </data> <success>1</success> <response_myCallbackFunction>
Is there a way to check if an object is empty in javascript?
-Thanks
source share