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 AJAX onCreate not working

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


Joined: 18 Oct 2006
Posts: 2

PostPosted: Wed Oct 18, 2006 2:53 pm    Post subject: Prototype AJAX onCreate not working Reply with quote

I'm trying to get "Loading..." to appear in the place of the div that's being updated. like so:

Code:
var myAjax = new Ajax.Updater(showDiv,url,{
      method:'get',
      onCreate: function(){
         $(showDiv).innerHTML = "Loading....";
      }
   });


Above code does not work. No errors, but no Loading....

I know I can make a global handler to do this al la:

Code:
   showDiv = div;
   var myGlobalHandlers = {
      onCreate: function(){
         $(showDiv).innerHTML = "Loading....";
      }
   };
   Ajax.Responders.register(myGlobalHandlers);


But I don't want to. Because sometimes I have one-way requests (that make no updates to the page the user is on). I did try to unregister myGlobalHandlers before making those types of "one-way" requests but that evoked a script error.[/code]


Last edited by yeago on Thu Oct 19, 2006 3:18 pm; edited 1 time in total
Back to top
View user's profile Send private message
Snyke
Forum Assistant
Forum Assistant


Joined: 20 Jun 2006
Posts: 87
Location: Zurich

PostPosted: Wed Oct 18, 2006 8:32 pm    Post subject: Reply with quote

Just manually set it to "Loading..." right after firing the request. By adding this into a onCreate event handler you just make it difficult. Event handlers are usefull in the case of responders but they are just useless if you fire a one time event.
_________________
[::[ Snyke.net ]::]
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
yeago
New one
New one


Joined: 18 Oct 2006
Posts: 2

PostPosted: Thu Oct 19, 2006 3:17 pm    Post subject: I'm a bit confused. Reply with quote

Didn't I say I wanted to avoid the Event Handler method?

I'm trying to add this manually to the Ajax Updater request (See the first snippet of code), but adding onCreate to that is not working.

Could you give me an example of 'manually adding' it to the first? I thought that's what I was attempting to do.
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 19, 2006 11:27 pm    Post subject: Reply with quote

onCreate would be the event hander style....
Anyway:
Code:
var myAjax = new Ajax.Updater(showDiv,url,{
  method:'get'
});
$(showDiv).innerHTML = "Loading....";

_________________
[::[ 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 Programmers Exchange 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