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); ?>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…