Skip to content
Advertisement

Calling javascript from php file failed

I have three different files: index.html, app.js, app.php. On HTML element <a href="./files/sweetsencrypt.pdf" onclick="return decrypt(this.href);">Decrypt Sweets</a> I am calling javascript function in which I am giving ajax call to PHP:

JavaScript

Till this everything is okay. When the PHP function is called, I need to call javascript functionality from app.js file in app.php file. But its getting failed. I am trying:

JavaScript

Here, not the showPDF(); function is called nor the alert('successful!') popup is shown. I am new to PHP. Where am I getting wrong? How to call javascript from PHP?

Advertisement

Answer

JavaScript

and in your ajax script

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement