-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fee6998
commit 85ac3c1
Showing
4 changed files
with
70 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,20 @@ | ||
function send(){ | ||
var user = document.getElementById("user").value; | ||
var msg = document.getElementById("text").value; | ||
$.get("http://127.0.0.1/add", { user : user , msg :msg }, function( data ,status ){ | ||
var sta = 1; | ||
if (sta ==1){ | ||
alert(status); | ||
$.get("http://127.0.0.1:8081/add", { user : user , msg :msg }, function( data ,status ){ | ||
console.log(status); | ||
}) | ||
} | ||
|
||
function re(){ | ||
var msg; | ||
$.get("http://127.0.0.1:8081/get", function( data , status ) { | ||
num = Object.keys(data).length;//获取返回留言长度 | ||
console.log(data[num]); | ||
var msg = data[0].user + data[0].msg + "-"; | ||
for (var i=1; i < num; i++){ | ||
msg = msg + data[i].user + data[i].msg + "-"; | ||
} | ||
console.log(msg); | ||
}) | ||
}s | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters