관리 메뉴

Data Analysis for Investment & Control

Ajax.Request 본문

Code/JS,AJAX

Ajax.Request

Jeongseob.Kim 2010. 9. 26. 00:48


A basic example

var url = '/proxy?url=' + encodeURIComponent('http://www.google.com/search?q=Prototype');
// notice the use of a proxy to circumvent the Same Origin Policy.

new Ajax.Request(url, {
  method: 'get',
  onSuccess: function(transport) {
    var notice = $('notice');
    if (transport.responseText.match(/href="http:\/\/prototypejs.org/))
      notice.update('Yeah! You are in the Top 10!').setStyle({ background: '#dfd' });
    else
      notice.update('Damn! You are beyond #10...').setStyle({ background: '#fdd' });
  }
});


reference link : http://www.prototypejs.org/api/ajax/request
 

'Code > JS,AJAX' 카테고리의 다른 글

DOM(Document Object Model)  (0) 2010.10.04
responseXML  (0) 2010.10.04
prototype.js  (0) 2010.09.26
Ajax.Request  (0) 2010.09.26
      
0 Comments
댓글쓰기 폼