dimanche 5 juin 2016

Checker null value of JSON by jquery

for example i acquire some json data like below

     errorCode: null,
        message: "Success",
        result: {
        keywordData: null, 
        },
       totalRecord: 1,
    checkAccess: true,
   token: xxxxx

As you see the keywordData is null.

And i am having a if statment in my JS like below

if(Object.keys(result.keywordData.length !== 0)){

  //do something

}

but it's not working, how may i check null value?

Aucun commentaire:

Enregistrer un commentaire