My problem is that I send the first PDF file to the client for download, then I need to check if there is any data in my database, then depending on this check I need to show that if the user wants to download another PDF file, I'm creating.
My code is:
//Here I just make dialog for question $('#printDWInfo').dialog({ resizable: false, modal: true, autoOpen: false }); //Here is my problem :) $('#generujWydruk').click(function (event) { event.preventDefault(); $('#printForm').submit(); // <-- sending first request and client get first PFD file $.post('<%: ResolveUrl("~/Reports/KPiRReportDWCheck") %>', <-- check for another data $("#printForm").serialize(), function(data) { if (data.length > 0) { $("#printDWInfo").dialog( "option", "buttons", [ { text: "Tak", click: function () { $.ajax({ type: "POST", url: '<%= Url.Action("PrintDWList","Reports")%>', datatype: "json", traditional: true, data:{'ids': data }, success: function (data2) { //I don't know what to do here } }); $(this).dialog("close"); } }, { text: "Nie", click: function () { $(this).dialog("close"); } } ]); $('
If the client clicks the "Tak" button in the dialog box, I use the ajax request because I can go to the array of int controllers that returns $.post('<%: ResolveUrl("~/Reports/KPiRReportDWCheck") %>' . In the successful function of my request, ajax FireBug shows me that data2 is the binary data of my PDF file, what do I need to do so that the client can download this PDF file?
source share