At my wit's end with Ajax.Updater |
[eluser]myerman[/eluser]
Having a lot of trouble (for some reason) with a VERY SIMPLE ajax application. Goes something like this: * Db table called bars has ID, NAME, PHONE of bars (as in pubs) * simple form asks for input from user * form posts to javascript function that runs a controller function * controller function runs model query, echos out results When run as a normal form post, everything is great. But when I turn on the ajax.updater..nothing. Any thoughts would be great. Here's the code. And yes, I started out the evening with Derek Allard's video tutorial...didn't work for me. I'm probably just really tired and can't see whatever it is that's in front of my face. CONTROLLER Code: class NdaClub extends Controller { MODEL Code: class MBars extends Model { VIEW (partial) Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
[eluser]myerman[/eluser]
I've reworked a few things (actually a TON of things) and finally resorted to (in some cases) literally copying and pasting Derek Allard's javascript onto my stuff, still with zero effect. Here is the new stuff. I can't believe how long this is taking--it took 15 minutes to code up the PHP, and approximately 11 hours and counting on this crazy Javascript crap. You'll notice that I have a controller function called getbar()...this I put in just to make sure my brain was working....I can go to http://www.tripledogs.com/ndaclub/getbar/texas and get back a list of bars whose name contain "texas". Same model function as with the form, but that doesn't work: http://www.tripledogs.com/ndaclub/index CONTROLLER Code: function index(){ MODEL Code: function search($term){ VIEW Code: <html> JAVASCRIPT Code: window.onload = function () {
[eluser]myerman[/eluser]
Forget it...I redid it with jquery, works mah-velous. Code: $(document).ready(function(){
[eluser]Hannes Nevalainen[/eluser]
Hmm, I can't see that you are including your javascript-files.. A suggestion is to download FireBug (a FireFox plugin) it's unvaluable when debugging javascripts regards //Hannes
[eluser]Derek Allard[/eluser]
Did the files from the video, unaltered, work for you? Also, I second the idea of Firebug - you'll at least be able to tell if the ajax call is getting made.
[eluser]Hannes Nevalainen[/eluser]
Yepp, they did. I also jumped across a thing in the javascript listed above.. I suspect you are using Prototype, then you should register your event handlers like this.. (to keep it cross-browser) Code: Event.Observe(window,'load',function(){
[eluser]Derek Allard[/eluser]
Actually Hannes, my question was meant for myerman, but I see now he resolved it, so I guess we're all done here |
Welcome Guest, Not a member yet? Register Sign In |