"run php function inside jquery click" Code Answer

5

You cannot run PHP code inside a jquery function. PHP runs on the server-side whereas jquery/javascript runs on the client-side. However, you can request a PHP page using jquery and with the PHP code on that page will run the mkdir that you want.

JS:

$.ajax({
  url: 'test.php',
  success: function(data) {
    alert('Directory created');
  }
});

test.php FILE:

 <?php mkdir('/test1/test2', 0777, true); ?>
By B. Bogart on September 18 2022

Answers related to “run php function inside jquery click”

Only authorized users can answer the search term. Please sign in first, or register a free account.