dialog is not open ??!!!
Hi,
my code for test dialog box:
html:
<body>
<input type="text" id="textToSave"/>
<input type="button" id="saveTxt" onclick="saveText()" />
</body>
javascript:
<script src="js/lib/prototype.js" type="text/javascript" ></script>
<script type="text/javascript">
function saveText() {
new Ajax.Request("api/saveData.cs", {
parameters: { q: "saveText", },
onSuccess: function(request) {
document.getElementById('textToSave').value = "return";
},
onFailure: function(request) {},
onException: function(exception) {}
});
}
</script>
saveData.cs:
public class saveData : IHttpHandler
{
public bool IsReusable { get { return true; } }
public void ProcessRequest(HttpContext c)
{
c.Response.Cache.SetNoStore();
c.Response.AddHeader("Content-Type", "application/x-javascript");
if (c.Request.Form["q"] == null) return;
switch (c.Request.Form["q"])
{
c.Response.ContentType = "application/ms-excel";
c.Response.AddHeader("content-disposition", "attachment; filename=test.xls");
c.Response.TransmitFile(c.Server.MapPath("../files/test.xls"));
//c.Response.Flush();
c.Response.End();
}
}
}
I have tried with flush and without , I also tried it on txt and jpg files.
The dialog box is not opened.
What am I doing wronge????:damnmate: