Download a pdf file using Jquery -
i want download pdf
file using jquery
, code works correctly little irritating problem pdf
file loads browser instead of giving saveas
dialog, don't know how solve code that
var timeout; $(document).on("click", "#downloadbtn", function(e){ cleartimeout(timeout); var textname = $('input[name=txtdatecheck]').val(); var optionselect = $('input[name=timeselected]').val(); settimeout(function() { $.ajax({ type: 'post', url: "checkurl.php", data: { checkurl: textname, optionid: optionselect}, datatype: 'text', success: function(response) { //alert(response); e.preventdefault(); //window.open(response.trim(), '_blank'); window.location.href = response.trim(); } }); }, 200); });
Comments
Post a Comment