Saturday, 17 August 2013

Not able to create new document in Iriscouch when async flag is true in open method

Not able to create new document in Iriscouch when async flag is true in
open method

I am trying to create a new document using javascript XMLHttpRequest on
irisCouch DB. It's working fine when "async" flag is false but with true
it is not creating new record . I don't know what's wrong with the code.
function dbStoreReg(userInfo){
alert("in function");
var url = ""; // some iriscouch DB
var method = "post";
var async = true;
var request = new XMLHttpRequest();
var userId = document.getElementById("username").value;
var userPass = document.getElementById("pass").value;
var noUsers = document.getElementById("allowedUsers").value;
var postData = "data" ;
var status = request.status
var data = request.responseText
**here is the open method that takes async**
request.open(method, url, async)
request.setRequestHeader("Content-Type","application/x-www-form-urlencoded")
request.setRequestHeader("Content-length", postdata.length)
request.send(postData)
}
any help on this?

No comments:

Post a Comment