jquery - downloading thru ajax and iframe? -
i have small piece if code:
$.post('exporttoexcel.php', function(data) { var iframe = document.createelement("iframe"); iframe.src = ""+data; iframe.style.display = "none"; document.body.appendchild(iframe); }); but nothing happens, i'm trying download file seamless server thru jquery's ajax.
anyone got fix?
if trying direct user file, download should use regular link or use location.href = 'my_url'; send browser there directly.
alternatively, if want 'seamless' way, don't use ajax post. link directly exporttoexcel.php in iframe.
if exporttoexcel.php requires use of post, make iframe visible , when exporttoexcel.php called via get, provide 'download' button same size iframe and, when clicked, submits regular html form same url via post.
Comments
Post a Comment