On 25 Aug 2008, at 23:13, Sam Murk wrote:
>
> So I was doing some experimenting with prototype and ajax and
> discovered
> something interesting. When I use the first ajax call the response
> from
> the server take 53ms. When I use the second on using the prototype
> functions the request from the server is over 200ms. My question is
> why, and can it be fixed?
>
You might find that the guys on the prototype-scriptaculous list are
more clued up on this.
Fred
>
> <p><a href="#"
onclick="serverSideAlert();">Call server-side
> function</a></p>
> <p id="responseTxt"></p>
> <script type="text/javascript">
> function serverSideAlert() {
> var request = new XMLHttpRequest();
> request.open(''get'',
''/jstest/server_response'', false);
> request.send(null);
> document.getElementById(''responseTxt'').innerHTML >
request.responseText;
> }
> </script>
>
> <script src="/javascripts/prototype.js"
type="text/javascript">
> </script>
>
> <p><a href="#"
onclick="updateElement()">Update element </a></p>
> <p id="response"></p>
> <script type="text/javascript">
> function updateElement() {
> new Ajax.Request(''/jstest/server_response'', {
onSuccess: function
> (request) {
> $(''response'').update(request.responseText);
> }})
> }
> </script>
>
> Thanks
>
> Sam Murk
> --
> Posted via http://www.ruby-forum.com/.
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---