刚学jquery,试了一个例子,有两个页面index.html,data.php,但每次执行都显示的都是乱码,请问该怎么办?
index.html
nbsp;HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
New Document <script></script>
<script> <br /> $(document).ready(function(){ <br /> $('#choice').change(function(){ <br /> if($(this).val()!='') <br /> { <br /> $.get( <br /> 'data.php', <br /> {what:$(this).val()}, <br /> function(data){ <br /> $('#result').html(data); <br /> }); <br /> } <br /> }); <br /> }); <br /> </script>
data.php
if($_GET['what']=='good')
{
$names=array('Sherlock Helmes','John Watson','Hercule Poirot','Jane Marple');
echo getHTML($names);
}
else if($_GET['what']=='bad')
{
$names=array('Professor Moriarty','Sebastian Moran','Charles Milverton','Von Bork','Count Sylvius');
echo getHTML($names);
}
function getHTML($names)
{
$strResult='
';
for($i=0;$i {
$strResult.='- '.$names[$i].'
';
}
$strResult.='
';
return $strResult;
}
?>
回复讨论(解决方案)
没有配置php的环境
最好的办法 看手册
还真是没配置PHP环境,谢谢
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