[Javascript] prototype onSuccess questen

Michael Borchers list at tridemail.de
Fri Dec 21 02:53:55 CST 2007


Question about:
http://www.prototypejs.org/api/ajax/request
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' });
  }
});Can I also call a defined function like foo()?function foo(){alert(transport.responseText);}If so, how do I pass the "transport"?onSuccess: function() { foo(transport) } won't work:(And onSuccess: function(transport) { test() } does not seem to pass "transport":/Any ideas?!

-- 
MfG
Michael Borchers
Tridem GmbH
http://www.tridem.de
mailto: borchers at tridem.de
Tel.: 0491 / 96 06 71 63
ICQ: 322766923
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20071221/e9f56e60/attachment.htm>


More information about the Javascript mailing list