Ajax Talk - Asynchronous javascript and xml discussion board
 FAQ   Search    Usergroups      Register   Profile   Check your messages   Log in 
Signup now to enjoy a range of free membership advantages !!
Ajax Talk - Moderators Wanted
Prototype help

 
Post new topic   Reply to topic    Ajaxtalk.com Forum Index -> AJAX Help
View previous topic :: View next topic  
Author Message
amitbhawnani
New one
New one


Joined: 12 Oct 2006
Posts: 3

PostPosted: Thu Oct 12, 2006 6:52 pm    Post subject: Prototype help Reply with quote

Hi, am using Prototype for all my AJAX work
I am trying to stop redundant requests from building up ..

Does anyone know how to use the below patch with prototype
http://scriptaculous.stikipad.com/scriptaculous/show/OnlyLatestOfClass
?

thanks in advance.........
Back to top
View user's profile Send private message
Snyke
Forum Assistant
Forum Assistant


Joined: 20 Jun 2006
Posts: 87
Location: Zurich

PostPosted: Thu Oct 12, 2006 10:30 pm    Post subject: Reply with quote

This script does nothing else than keeping track of what requests already run and replace it if a new request is being opened. What happens is that onCreate registers the request in an array and onComplete removes it, if onCreate finds that we already have a similar (class...) request it will first be aborted.
Just add the code to the Prototype library and upon creation add the onlyLatestOfClass option to the newly created Request
_________________
[::[ Snyke.net ]::]
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
amitbhawnani
New one
New one


Joined: 12 Oct 2006
Posts: 3

PostPosted: Fri Oct 13, 2006 3:44 am    Post subject: Reply with quote

Thanks for your help Smile
I am still a bit lost though ;-(

Below is an example of how i am using protoype

Code:

<script>
   function getHTML()
   {
      var url = 'http://yourserver/app/getSomeHTML';
      var pars = 'someParameter=ABC';
      
var myAjax = new Ajax.Updater( 'placeholder', url, { method: 'get', parameters: pars });

   }
</script>

<input type=button value=GetHtml onkeypress="getHTML()">
<div id="placeholder"></div>
         


You you tell me what changes i should make?
Back to top
View user's profile Send private message
Snyke
Forum Assistant
Forum Assistant


Joined: 20 Jun 2006
Posts: 87
Location: Zurich

PostPosted: Fri Oct 13, 2006 10:18 pm    Post subject: Reply with quote

Ever tried something like this:
Code:

<script>
   function getHTML()
   {
      var url = 'http://yourserver/app/getSomeHTML';
      var pars = 'someParameter=ABC';
      
var myAjax = new Ajax.Updater( 'placeholder', url, { method: 'get', parameters: pars , onlyLatestOfClass:"htmlfetcher"});

   }
</script>

<input type=button value=GetHtml onkeypress="getHTML()">
<div id="placeholder"></div>
         

? No idea if it works....
_________________
[::[ Snyke.net ]::]
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
amitbhawnani
New one
New one


Joined: 12 Oct 2006
Posts: 3

PostPosted: Sat Oct 14, 2006 2:46 am    Post subject: Reply with quote

It works perfectly !!
Amazing !
Thanks a LOT
Back to top
View user's profile Send private message
Snyke
Forum Assistant
Forum Assistant


Joined: 20 Jun 2006
Posts: 87
Location: Zurich

PostPosted: Sat Oct 14, 2006 8:17 am    Post subject: Reply with quote

Fine, yet another detail to put into my codebase ^^
_________________
[::[ Snyke.net ]::]
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Ajaxtalk.com Forum Index -> AJAX Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
 Advertisements
 XML & Copyright Notice 
    


Powered by phpBB © 2001, 2005 phpBB Group

What is according to Wikipedia: Ajax Web2.0 XML E4X


Link to our site:

  


del.icio.us digg spurl wists simpy newsvine blinklist furl blogmarks yahoo! myweb smarking ma.gnolia segnalo reddit fark technorati cosmos


Normal Bookmark


Partner Button Links:
Codecrunch.com: Webmaster Tutorials    One Ajax


Partner Text Links:
quomon | web20log | ajaxmatters | tableless | 456bereastreet | music charts | gift ideas | competitions | free xbox 360 | link trade ?


Credits:
it consultancy & project management lead generation zoekmachine optimalisatie steal these buttons seo expert