<li>function getProfile(str) {<li> var arr = str;<li> document.getElementById('nick').innerHTML = arr.nick;<li>}<li> 复制代码 php文件:profile.php $arr = array( 'name' => '李飞麟', 'nick' => '深空', 'contact' => array( 'email' => 'shenkong at qq dot com', 'website' => 'http://bbs.it-home.org', ) ); $json_string = json_encode($arr); echo "getProfile($json_string)"; ?> 复制代码