view postscript.js @ 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
line wrap: on
line source

function XMLRequest() {
    if (this.XMLHttpRequest) {
        return new XMLHttpRequest();
    } else {
        alert("Your browser not support XMLHttppRequest ");
    }
}

function stringPost() {
    var form = document.getElementById("form_id");
    var postString = form.text.value;
    var obj = XMLRequest();
    obj.onreadystatechange = function() {
        if (obj.readyState == 4 && obj.status == 200) {
	    document.getElementById("outputdiv").textContent = obj.responseText;
        }
    }
    var URL = 'http://localhost:9000/db/data/node';
    obj.abort();
    obj.open('POST',URL, true);
    obj.setRequestHeader('Accept','application/json');
//    obj.setRequestHeader('Content-Type','application/json');
    obj.send();
}