I have a function inside jQuery when a PHP function is called when the condition is met. Everything is going well until I can file_put_contents. It seems like it should produce some kind of output that jQuery does not know how to interpret. Here is my code:
Part of jQuery where $ downloader is an instance of a class and complete. Download is a javascript variable:
if (finishedDownloading==<?php echo $downloader->_totalFiles ?>){ <?php $downloader->MergePDFs(); ?> }
So far so good. And here is my php:
function MergePDFs() { $combinedFiles = ""; foreach ($this->_fileNamesArray as $filename) { $combinedFiles .= file_get_contents($filename);
If I comment out the lines of file_put_contents, everything goes smoothly.
If I uncomment when I run the code, I get a crazy "uncaught referenceError" error stating that my JQuery function is undefined.
Can someone tell me what's going on?
thanks
Edit: I think file_put_contents returns some value that jQuery does not know what to do.
Edit 2: This cannot be done, even if I was able to get rid of the jquery error, the function will execute when the page loads, not taking into account the if statement
source share