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

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -