javascript include file at onclick
问题 Is there a way to include some php file at javascript onClick ? like, if(isset(something)) ? include "file.php"; Please help! 回答1: No. That's PHP syntax. PHP executes completely on the server and the result is sent back to the client. Clicks are on the client side. Javascript handles those. Your can't mix the two. You can use AJAX to make a request to the server for a file and display its contents using JS, though. jQuery has a simple method called .ajax() for this $.ajax({ url: 'file.php',