Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Closure XhrIo

I am new to Google Closure and I would like to know on how XhrIo works. I have read the overview of XHRIO http://code.google.com/closure/library/docs/xhrio.html

basically, I am following the example but I just can't make it work. I am using eclipse and tomcat as my server to perform the example. Can someone please enlighten me on just how to make the connection between html, the java script that uses the goog.require('goog.net.XhrIo'); and the json file? Thank you guys.

like image 984
max Avatar asked Aug 25 '11 02:08

max


1 Answers

Here is a sample to make a post request:

goog.require('goog.Uri');
goog.require('goog.net.XhrIo');

var qd = new goog.Uri.QueryData(); 
qd.add('name1', 'val1'); 
qd.add('name2', 'val2'); 
function done(e) { 
   this.getResponseText();
   this.getResponseJson();
}  
goog.net.XhrIo.send('/controller/action', done, 'POST', qd.toString());
like image 81
Maxence Avatar answered Sep 22 '22 15:09

Maxence