annotate postscript.js @ 9:5068e7dc31c1 draft

add post.html and postscript.js
author Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
date Fri, 21 Sep 2012 00:57:08 +0900
parents
children 6fdf1b084a00
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9
5068e7dc31c1 add post.html and postscript.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 function XMLRequest() {
5068e7dc31c1 add post.html and postscript.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 if (this.XMLHttpRequest) {
5068e7dc31c1 add post.html and postscript.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 return new XMLHttpRequest();
5068e7dc31c1 add post.html and postscript.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 } else {
5068e7dc31c1 add post.html and postscript.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 alert("Your browser not support XMLHttppRequest ");
5068e7dc31c1 add post.html and postscript.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 }
5068e7dc31c1 add post.html and postscript.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 }
5068e7dc31c1 add post.html and postscript.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8
5068e7dc31c1 add post.html and postscript.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 function stringPost() {
5068e7dc31c1 add post.html and postscript.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 var form = document.getElementById("form_id");
5068e7dc31c1 add post.html and postscript.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 var postString = form.text.value;
5068e7dc31c1 add post.html and postscript.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 var obj = XMLRequest();
5068e7dc31c1 add post.html and postscript.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 obj.onreadystatechange = function() {
5068e7dc31c1 add post.html and postscript.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 if (obj.readyState == 4 && obj.status == 200) {
5068e7dc31c1 add post.html and postscript.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 document.getElementById("textarea").value = obj.responseText;
5068e7dc31c1 add post.html and postscript.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 }
5068e7dc31c1 add post.html and postscript.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 }
5068e7dc31c1 add post.html and postscript.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 var URL = 'http://localhost:9000/db/data/node';
5068e7dc31c1 add post.html and postscript.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 obj.abort();
5068e7dc31c1 add post.html and postscript.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 obj.open('POST',URL, true);
5068e7dc31c1 add post.html and postscript.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 <!--
5068e7dc31c1 add post.html and postscript.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 obj.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
5068e7dc31c1 add post.html and postscript.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 -->
5068e7dc31c1 add post.html and postscript.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 obj.send();
5068e7dc31c1 add post.html and postscript.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 var resStr = obj.responseText;
5068e7dc31c1 add post.html and postscript.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 }