code: function (url, data, onDone) {
  
      SR.Log('url to post: ' + url);
  
      // construct an HTTP request
      var xmlHttp = new XMLHttpRequest();
      xmlHttp.open("POST", url, true);
      xmlHttp.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
      
      // set callback when response is returned
      xmlHttp.onloadend = onHttpResponse(xmlHttp, onDone);
  	//console.log('data to send:');
  	//console.log(data);
  	
      // send the collected data as JSON
  	// TODO: may be slow in Firefox?
  	xmlHttp.send(Object.keys(data).length > 0 ? JSON.stringify(data) : undefined);
  }
docs: ref: http://stackoverflow.com/questions/1255948/post-data-in-json-format-with-javascript