open-xml-templating / docxtemplater

Generate docx, pptx, and xlsx from templates (Word, Powerpoint and Excel documents), from Node.js or the browser. Demo: https://www.docxtemplater.com/demo. #docx #office #generator #templating #report #json #generate #generation #template #create #pptx #docx #xlsx #react #vuejs #angularjs #browser #typescript #image #html #table #chart
https://www.docxtemplater.com
Other
2.92k stars 341 forks source link

Getting a click event when a document is saved. #63

Closed sm1990 closed 9 years ago

sm1990 commented 9 years ago

I need to save the date a document was generated or downloaded in the database. I tried to capture a click event. I'm using the downloadify function to save the file.

My javascript code is below.

$(document).ready(function(){
if($("#downloadify").children().length==1){
$.post( "update.php", { dates:'<?php echo $dates; ?>', caseid:'<?php echo $caseid; ?>' }, function(data) { //alert(data); $('#dates').val(data); }); } });

Can you please explain how to do this.

Thanks,

edi9999 commented 9 years ago

Hi,

I don't see the code where you are using with docxtemplater. Can you please add that?

Or maybe even better create a jsfiddle with your issue.

Best, Edgar

sm1990 commented 9 years ago

Hi,

Thanks for the quick respond. i'll try a jsfiddle.

My code is below.

$dates is the variable that i need to send to database.

Thanks,

edi9999 commented 9 years ago

Have you solved your issue since then ?

I guess you could write the $.post function just after the doc.download function.

sm1990 commented 9 years ago

Hi, I tried some methods. One seems to be working when inserting new row to the table. In updation it doesn't work. I'll try your method too. Thanks

sm1990 commented 9 years ago

Hi, Sorry for the late reply. I found a solution. I added an onchange event to the location where the "save to disk" button loads. Thanks

edi9999 commented 9 years ago

Ok great