Hi Khan,

I am new to AJAX, tried to execute following Ajax.Request code..
For some reason it doesn't seem to be working. Nothing is happening
when I click on the button.
I had make sure prototype.js is in place and imported it in the html
can you help me ...

I picked this code from prototypejs.org.

I'm using prototype Version: '1.2.1'

Thanks in Advance.


<html>
<head>
<script type='text/javascript' src='../../samplestrutsappWeb/resources/
js/prototype.js'></script>
<script type='text/javascript' src='../../samplestrutsappWeb/resources/
js/rico.js'></script>
<script type='text/javascript'>
   function fnAR123()
   {
       alert("1");
       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' });
                                         }
                             }
                       );
       alert("2");
   }

</script>

</head>

<body>
       <input type="button" value="Click" onClick="fnAR123();"/>
</body>
</html>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to