Hi
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 anyone help me ...
<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>
Thanks
mark
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---