Basically I would like to have a button that people could click to export some data. Currently I have this hooked up to an ajax call that hits some code I have on the server to get the data. Unfortunately the user is never prompted to save a file or anything, the call is just successfully made.
If I look at the response to the ajax call it has the JSON that I want to export in it. Here is the code I have come up with so far:
#exportData is just a function that gets data based off of a surveyId
@exportData req.body.surveyId, (data) ->
res.attachment('export.json')
res.end(JSON.stringify(data),'UTF-8')
Any suggestions to get this to prompt the user to save the file rather than just quietly returning the data?