开发者

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 ju开发者_开发技巧st 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.


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());
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜