Download excel file using Ajax MVC
<p>How to download a file using Ajax in MVC. If no data to generate file then show error label. 
I'm trying using action result method which returns File. I can download file . but don't want to refresh the page if no file to download. 
My code is like </p>

<pre><code>public ActionResult Excel(MyViewModel model)

{

    var result = // DB call to get data

    if (no data)
    {
        return **something**
    }
    else
    {
        byte[] excelContent =//passing result to my method( returns xls file in byte)

        return File(
                    excelContent, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
                    reportName + " Report " + startDate + " - " + endDate + ".xlsx");
    }
}
</code></pre>

<p>What should I return for <strong>something</strong>
For now I'm returning emptyResult for <strong>something</strong>  hence I got blank page if no data.
Ajax doesn't support file download.
This code works if I submit the form and there is data.
Suggest something in which page will not get refresh and both task get achieved.
1. File download if data
2. Show error label if no data</p>