我想使用jQuery在页面的某个点包含一些PHP.当jQuery找到#site-index .sitetopic我想要从名为images.php的PHP文件中追加内容的类时.
我认为我可以使用 include or file_get_contents
就像是:
OnLoad.find('#site-index .sitetopic')
InsertPHP
Run Code Online (Sandbox Code Playgroud)
您无法在客户端上插入服务器端代码.
当Jquery执行时,服务器已经完成处理页面.
但是你可以使用你使用jquery添加的iframe,甚至可以使用jquery的.load函数http://api.jquery.com/load/