Oh yeah, this is the source in the page after it is rendered: <div id="testola"></div> <a href="/user/login/" id="link191330890" onclick=" return false;">Log In</a> <script type="text/javascript"> Event.observe('link191330890', 'click', function(event){ new Ajax.Updater('mainContent','/user/login/', {asynchronous:true, evalScripts:true, requestHeaders:['X-Update', 'mainContent']}) }, false); </script>
On Mar 26, 11:48 am, "Christopher E. Franklin, Sr." <[EMAIL PROTECTED]> wrote: > I feel like an idiot for asking since there are so many posts in this > group on Ajax->link questions but, I have already wasted 2 hours > trying to find the answer. > > I was following a small tutorial to get Ajax working (the one with the > stars =D ) and it didn't work. So, I tried to do a little test and > this is my real problem, > > I can use $ajax->link and get a link to show up. Viewing the source, > you can see the javascript being inserted after the link for an ajax > call. The problem is, when I click on the link, nothing happens. > Using FF2 or IE7. I get no errors whatsoever (using Firebug). > Firebug tells me that no XMLHTTPRequests were made at all. > > This leads me to believe that there is an error in my coding somewhere > but, looking at the cake manual and other references, it seems that my > code is correct. > > Maybe another pair of eyes can spot something that I am missing. > > Keep in mind that this is supposed to be a simple test for me to get > the feel of how Ajax works with cakephp. > I want to displayhttp://localhost/user/and get an Ajax link called > Log In. When I click Log In, it will callhttp://localhost/user/login/ > and I was expecting the result (<p>Hi!</p>) to update into my test div > (testola). > When I click login, it does nothing, no errors, no request calls, > nothing. See the (**) notes after each piece of code. > > I am at a loss here. Sorry for the long post, I am trying to be > thorough. > > The info: > CakePHP :: 1.3.1 > Prototype :: 1.5.1_rc2 > Scriptaculous :: 1.7.1_beta1 > Firefox :: 2.0 > Internet Explorer :: 7.0 > PHP :: 5 > Apache :: 2 > > Here is the ajax code I have: > > // /app/plugins/user/view/user/index.thtml > > <div id="mainContent"> > <h1>Welcome to the user plug-in</h1> > <hr /> > <?php > echo $ajax->div('testola'); > echo $ajax->divEnd('testola'); > $ajaxLoginOptions = array('update' => 'test'); > echo $ajax->link('Log In', '/user/login/', array('update' => > 'testola', 'url' => 'login/'), null, false); > ?> > </div> > **I have tried this with the ajax->div and without just using a hard > div tag. I have also tried passing a variable with and without the > url array key/value. None work > > // /app/plugins/user/user_app_controller.php > > <?php > class UserAppController extends AppController { > public $helpers = array('Html', 'Javascript', 'Ajax');} > > ?> > **I have included the Javascript and Ajax helpers. I have no problems > loading js files from default.thtml > > // /app/plugins/user/controllers/user_controller.php > > <?php > class UserController extends UserAppController { > > function index() > { > > } > > function register() > { > > } > > function login() > { > $this->render('login', 'ajax'); > } > > function logout() > { > > }} > > ?> > ** Under function login, I have commented this out and left it in to > test, neither work > > // /app/plugins/user/views/login.thtml > > <p>Hi</p> > **This is what I want to update my div with --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---