Filedownload using jquery

Filedownload using jquery

hi all,

i have below code in my c# layer to start the download.  I want to re-enable my UI once the download starts.  but since i have already changed the header, i am not able to fire any javascript code.

 Response.Clear()
'Add Response header
Response.AddHeader("content-disposition", String.Format("attachment;filename={0}.csv", "RawDetailReport"))
Response.Charset = ""
Response.ContentType = "application/vnd.xls"
'Append Data
dtrReader.NextResult()
etc..

is there a solution for this in jquery.  Few points to note
1. I am not creating the file physically in server.  i am forming a coma separated string and pushing it to the browser as it is formed.
2. actual requirement is - when the user clicks the download button, i want to disable the UI and then make a call to server, where i make a call to stored procedure.  stored procedure comes up with a recordset.  at this oint of time i want to re-enable the UI and start the download.