在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
(1)text/plain 服务器端: header('Content-Type: text/plain'); echo 'succ'; 客户端: if(xhr.responseText==='succ'){ ... } (2)text/html 服务器端: header('Content-Type: text/html'); echo "<tr><td>$data</td></tr>"; 客户端: tbody.innerHTML = xhr.responseText (3)application/javascript 服务器端: header('Content-Type: application/javascript'); echo "alert($data); f1(); f2($data)"; 客户端: eval( xhr.responseText ) (4)application/xml 服务器端: header('Content-Type: application/xml'); echo "<bookList><book>$b</book></bookList>"; 客户端: var document = xhr.responseXML (5)application/json 服务器端: header('Content-Type: application/json'); //echo "[ {"bname":"","price":35.5},{} ]"; $list = ...; echo json_encode($list); 客户端: var obj = JSON.parse( xhr.responseText ) |
2022-08-18
2022-08-17
2022-08-15
2022-11-06
2022-08-17
请发表评论