Home  >  Article  >  Backend Development  >  怎么用JS获取PHP页面内容

怎么用JS获取PHP页面内容

WBOY
WBOYOriginal
2016-06-13 12:27:331051browse

如何用JS获取PHP页面内容?
用http://localhost:8081/1.php可以访问到 ‘admin’ 这个内容,我想用JS把这个内容显示出来,有人说用AJAX来写,百度了好几天也没有解决,请教各位老师如何做到啊?谢谢!
------解决思路----------------------
你的 1.php 输出的是 js 脚本,要这样写

$.getScript('1.php', function() {<br />  alert(province)<br />});<br />

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn