Mercurial > hg > Members > nobuyasu > TwitterBootstrap
changeset 10:6fdf1b084a00 draft
modified postscript.js
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 21 Sep 2012 15:06:14 +0900 |
parents | 5068e7dc31c1 |
children | 899900981cf8 |
files | post.html postscript.js |
diffstat | 2 files changed, 9 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/post.html Fri Sep 21 00:57:08 2012 +0900 +++ b/post.html Fri Sep 21 15:06:14 2012 +0900 @@ -4,11 +4,16 @@ </head> <body> +<!-- <form id="form_id" action="postURL" method="post"> +--> + <form id="form_id" method="post"> <input type="text" name="text"> <input type="submit" onclick="stringPost(); return false" value="send"> </form> - <textarea id="textarea"></textarea> + <div id="outputdiv" style=""> + + </div> </body> </html>
--- a/postscript.js Fri Sep 21 00:57:08 2012 +0900 +++ b/postscript.js Fri Sep 21 15:06:14 2012 +0900 @@ -12,15 +12,13 @@ var obj = XMLRequest(); obj.onreadystatechange = function() { if (obj.readyState == 4 && obj.status == 200) { - document.getElementById("textarea").value = obj.responseText; + document.getElementById("outputdiv").textContent = obj.responseText; } } var URL = 'http://localhost:9000/db/data/node'; obj.abort(); obj.open('POST',URL, true); -<!-- - obj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); ---> + obj.setRequestHeader('Accept','application/json'); +// obj.setRequestHeader('Content-Type','application/json'); obj.send(); - var resStr = obj.responseText; }