I have an ActionResult which return PartialView() or new EmptyResult(), How to detect in JS callback function if returned data is EmptyResullt()? I have tried many ways, i.e. compare with null or with undefined but no results. console.log(data) shows blank space. Any tips and 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) //<---- this does not work
{
//then sth;
}
})
}
datain order to check whether it is empty or not. Does it come back as an object? an array? a string? Tryconsole.log(data)