第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定

員工信息保存成功,但頁面沒反應(yīng)

按照老師的步驟,在頁面上提交員工信息后,respond中顯示保存成功

https://img1.sycdn.imooc.com//5b03ff670001cf9410790667.jpg

但是在頁面上沒有反應(yīng)。

https://img1.sycdn.imooc.com//5b03ff810001a49a08360374.jpg

但是上一個功能,即查詢功能完全沒問題。代碼我是復(fù)制下來修改的。是這樣

<font face="Arial, Helvetica, sans-serif"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Demo</title>


<style>

*{

font-size:30px

}

</style>

</head>


<body>

<h1>員工查詢</h1>

<label>請輸入員工編號:</label>

<input type = "text" id="keyword"/>

<button id="search">查詢</button>

<p id="searchResult"></p>


<h1>員工新建</h1>

<p>

? <label>請輸入員工姓名:</label>

? <input type = "text" id="stuffName"/><br />

??


? <label>請輸入員工編號:</label>

? <input type = "text" id="stuffNumber"/><br />

? <label>? 請輸入員工性別:</label>

? <select id="stuffSex">

? <option>男</option>

? ? <option>女</option>

? </select>

??

<br />

? <label>? 請輸入員工職位:</label>

? <input type = "text" id="stuffJob"/>

? <br />

? <button id="save">確認(rèn)</button>

? <p id=createResult"></p>

</p>



<script>


document.getElementById("search").onclick = function(){

//發(fā)送ajax查詢請求并處理

var request = new XMLHttpRequest();

? ? request.open("GET","servers.php?number=" + document.getElementById("keyword").value);

? ? request.send();

? ? request.onreadystatechange = function(){

? ? if(request.readyState === 4){

? ? ? ? if(request.status ===200){

? ? ? ? ? ? document.getElementById("searchResult").innerHTML = request.responseText;

? ? ? ? ? ??

? ? ? ? ? ? }else{

? ? ? ? ? ? alert("發(fā)生錯誤"+request.status)

? ? ? ? ? ? }

? ? ? ? ? ??

? ? ? ? }

? ? }

? ??


}



/*

*POST請求編寫

*新增人員

*/


//POST 請求


document.getElementById("save").onclick = function(){

//發(fā)送ajax? ?POST請求并處理

var request = new XMLHttpRequest();

? ? request.open("POST","servers.php");

? ? var data = "name=" + document.getElementById("stuffName").value +

? ? ?"&number=" + document.getElementById("stuffNumber").value +

? ? ? "&sex=" + document.getElementById("stuffSex").value +

? ? ? ?"&job=" + document.getElementById("stuffJob").value;

? ? request.setRequestHeader("Content-Type","application/x-www-form-urlencoded")

? ? request.send(data);

? ? request.onreadystatechange = function(){

? ? if(request.readyState === 4){

? ? ? ? if(request.status ===200){

? ? ? ? ? ? document.getElementById("createResult").innerHTML=request.responseText;

? ? ? ? ? ??

? ? ? ? ? ? }else{

? ? ? ? ? ? alert("發(fā)生錯誤"+request.status)

? ? ? ? ? ? }

? ? ? ? ? ??

? ? ? ? }

? ? }

? ??


}




</script>

</body>

</html>

</font>



我的sever.php文件在建立的時候拼錯了,所以這里的也不對(原諒我的渣渣英語)。查詢功能是對的。

看到有人和我是一樣的問題,解決方法是端口問題。我的Apache端口是8081.

https://img1.sycdn.imooc.com//5b040020000192fe06040256.jpg

求幫助??!

正在回答

1 回答

</script>

</body>

</html>

</font>

最后的</font>哪里來的?

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

qq__3734 提問者

那個是寫錯了,但是不是因為那個啊。我去掉了還是有問題
2018-05-23 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消
Ajax全接觸
  • 參與學(xué)習(xí)       224774    人
  • 解答問題       708    個

本課程通過一個案例,講解Ajax的相關(guān)概念原理實現(xiàn)方式和應(yīng)用

進(jìn)入課程

員工信息保存成功,但頁面沒反應(yīng)

我要回答 關(guān)注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號