javascript - Detect Empty result in JS -


i have actionresult return partialview() or new emptyresult(), how detect in js callback function if returned data emptyresullt()? have tried many ways, i.e. compare null or undefined no results. console.log(data) shows blank space. tips , tricks? :)

"more code":

controller:

    public actionresult checkif(int d)     {         if (d == 2) return new emptyresult();         else return partialview();     } 

js function:

function sth () {     $.get('/home/checkif/', {d: 2}, function(data){         if(data === null) //<---- not work         {             //then sth;         }     }) } 

usually, checking if (data) { // } work.

to check empty string, using data === '' should work.


Comments