Can someone please explain to me what I need to do to create an Ajax class using the prototype lib. Thanks, Jon Whitcraft Web Application Developer Online Services - Indianapolis Motor Speedway (317) 492-8623 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails-spinoffs/attachments/20050803/2f662bb3/attachment.html
On 8/4/05, Whitcraft, Jon <jwhitcraft@brickyard.com> wrote:> > Can someone please explain to me what I need to do to create an Ajax class > using the prototype lib.Hi, I''m guessing you want to create an ajax callback... var ajax = new Ajax.Request( ''http://sharp.id.au/myResponder.py'', { asynchronous:true, method:''get'', evalScripts:true, parameters: ''in_jncounter=''+jncounter, onComplete:function(request){ // do something with the request object // e.g. var myResponse = request.responseText; } } I havent tested this specific bit of code, but it should at least point you in the right direction. The parameters are pretty self explanatory, and onComplete is a callback method you can use to do something when the ajax call is completed. One thing to be aware of is that the default prototype librarary appends ''&_='' to the end of the querystring, so make sure that the responder you are using doesn''t mind. I was using PLSQL and Oracle didn''t like it :-(. It''s also worth installing the LiveHTTPHeaders extension for firefox so you can see the data moving back and forward. On another note, there isn''t much documentation for those of us that use prototype sans RoR, is there a wiki page that we could put code snippets on? Hope that helps, Rob.> > Thanks, > > Jon Whitcraft > Web Application Developer > Online Services - Indianapolis Motor Speedway > (317) 492-8623 > > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > >-- Rob Sharp email/jabber: rob@sharp.id.au web: http://sharp.id.au pgp: 0E2C C63B BA04 DEB4 7CC0 84FD 17E3 6AA4 87FB 62DF
Rob, Thanks. That helps a lot. I got a working example. Once i get it done and in place ill submit my code back to the list. Jon ________________________________ From: Rob Sharp [mailto:rob.sharp@gmail.com] Sent: Wed 8/3/2005 5:02 PM To: Whitcraft, Jon Cc: rails-spinoffs@lists.rubyonrails.org Subject: Re: [Rails-spinoffs] Ajax in prototype.js On 8/4/05, Whitcraft, Jon <jwhitcraft@brickyard.com> wrote:> > Can someone please explain to me what I need to do to create an Ajax class > using the prototype lib.Hi, I''m guessing you want to create an ajax callback... var ajax = new Ajax.Request( ''http://sharp.id.au/myResponder.py'', { asynchronous:true, method:''get'', evalScripts:true, parameters: ''in_jncounter=''+jncounter, onComplete:function(request){ // do something with the request object // e.g. var myResponse = request.responseText; } } I havent tested this specific bit of code, but it should at least point you in the right direction. The parameters are pretty self explanatory, and onComplete is a callback method you can use to do something when the ajax call is completed. One thing to be aware of is that the default prototype librarary appends ''&_='' to the end of the querystring, so make sure that the responder you are using doesn''t mind. I was using PLSQL and Oracle didn''t like it :-(. It''s also worth installing the LiveHTTPHeaders extension for firefox so you can see the data moving back and forward. On another note, there isn''t much documentation for those of us that use prototype sans RoR, is there a wiki page that we could put code snippets on? Hope that helps, Rob.> > Thanks, > > Jon Whitcraft > Web Application Developer > Online Services - Indianapolis Motor Speedway > (317) 492-8623 > > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > >-- Rob Sharp email/jabber: rob@sharp.id.au web: http://sharp.id.au pgp: 0E2C C63B BA04 DEB4 7CC0 84FD 17E3 6AA4 87FB 62DF