views:

25

answers:

1

so I have a fuction that exports some data async via asp.net and displays a URL on the page to download the exported file, it works perfectly in chrome. but in internet explorer, it displays the link, but the link is not click-able, it just renders as plain text!

The data returned Export.aspx contains the Url to the exported file. (Remember it works perfectly in chrome)

function doExport(oper) {
                var pass = prompt("Please enter the Admin password", "none");
                if (hex_md5(pass) == "592e19c40272fcc615079c346a18d140") {
                    $("#btnExportStat").attr('disabled', 'disabled');
                    $("#btnExportView").attr('disabled', 'disabled');
                    $("#btnAfter").after("<p id='loading'>Please wait...<img src='images/loading.gif' /></p>");
                    jQuery.post("Export.aspx", { "type": oper }, function (data) {
                        $('#loading').remove();
                        if (data.toString() == "error") {
                            $('#btnAfter').after("<b>There was an error</b>");
                        } else {
                            var d = new Date();
                            var curr_hour = d.getHours();
                            var curr_min = d.getMinutes();
                            var sec = d.getSeconds();
          ========>>>//$('#btnAfter').after("<a href='" + data + "'>" + "Click here to Download File(" + curr_hour + ":" + curr_min + ":" + sec + ")</p>");
                            $("#btnExportStat").attr('disabled', '');
                            $("#btnExportView").attr('disabled', '');
                        }
                    });
                } else {
                alert("Incorrect password");
                }
            }
+2  A: 

You start with <a> but end with </p> ...

Call me old-fashioned but I generally add markup differently:

$('#btnAfter').after($("<a/>")
  .attr('href', data)
  .text("Click here to Download File(" + curr_hour + ":" + curr_min + ":" + sec + ")")
);

It's a little harder to make such typos then.

Pointy
+1 Good catch Pointy! Also, don't forget 1.4 notation is another option: `$("<a />", { href: data, text: "Click...." })`
Doug Neiner
Oh right; like I said, "old-fashioned".
Pointy
omg I'm so embarrassed! Omg! I was caught up with the idiotproofing this so much I didnt even see that! And so to "fix" it I just added a alert saying please use the export function in Google Chrome!! Jeez!! **covers head with paper bag**
giddy