Mercurial > hg > Members > nobuyasu > TwitterBootstrap
annotate postscript.js @ 11:899900981cf8 draft
modified
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 21 Sep 2012 17:38:11 +0900 |
parents | 6fdf1b084a00 |
children |
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) { |
10
6fdf1b084a00
modified postscript.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
9
diff
changeset
|
15 document.getElementById("outputdiv").textContent = obj.responseText; |
9
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); |
10
6fdf1b084a00
modified postscript.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
9
diff
changeset
|
21 obj.setRequestHeader('Accept','application/json'); |
11 | 22 obj.setRequestHeader('Content-Type','application/json'); |
9
5068e7dc31c1
add post.html and postscript.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
23 obj.send(); |
5068e7dc31c1
add post.html and postscript.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
24 } |