Notice
Recent Posts
Recent Comments
Data Analysis for Investment & Control
Ajax.Request 본문
반응형
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' });
}
});
// 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 > WEB' 카테고리의 다른 글
스마트한 게시판 만들기 - 네이버 <스마트 에디터>와 다음 <다음 에디터>의 오픈소스 활용 (0) | 2010.10.12 |
---|---|
DOM(Document Object Model) (0) | 2010.10.04 |
responseXML (0) | 2010.10.04 |
HTML TAG - <span> (0) | 2010.09.29 |
prototype.js (0) | 2010.09.26 |
Comments