Re: MooTools Ajax with Cake

2009-03-11 Thread Arak Tai'Roth

very cool, thanks for your help.

On Mar 11, 11:31 am, mark_story  wrote:
> No worries,  glad to hear you got it all sorted.  MooTools can have a
> pretty steep learning curve, as it doesn't have as many one liners as
> other libraries, but if you stick with it, there is a lot of power and
> features under the hood.  As for neat shortcuts, look at
> Element.implement() you can add on additional element shortcuts that
> trigger effects.  The Chain class is also a really powerful and
> interesting class.
>
> -Mark
>
> On Mar 10, 10:06 pm, "Arak Tai'Roth"  wrote:
>
> > Also not to be an ass. But I have effects working, you are right there
> > is tons of documentation. I was just checking if anyone had any cool
> > ideas I hadn't thought of.
>
> > I also did get it working just fine with multiple elements of the same
> > name.
>
> > Copy and pasting can lead to a lot of issues with no understanding I
> > agree. However it gets you something to work on right away and gives
> > you a more practical way to learn, and for me, that's far more useful.
>
> > On Mar 10, 10:56 am, mark_story  wrote:
>
> > > Not to be an ass, but mootools has tons of documentation, examples and
> > > tutorials.  You can find lots of information on how you use effects in
> > > the mootools docss.  Furthermore if you have more than one element
> > > with the same ID don't expect anything to work properly.  In addition
> > > Element.load() does do an AJAX request.  Just as a GET instead of a
> > > POST type request.  But if you are new to Ajax and Mootools, I would
> > > start with the docs, copy+pasting is going to lead to lots of these
> > > type issues.
>
> > > -Mark
>
> > > On Mar 9, 4:39 pm, "Arak Tai'Roth"  wrote:
>
> > > > Well it looks like I got it all working. Now I just need to figure out
> > > > how to add some kind of effect to it. If anyone has any advice on
> > > > that, that would be perfect.
>
> > > > On Mar 9, 11:43 am, "Arak Tai'Roth"  wrote:
>
> > > > > So I completely revamped the code in my ajax file to this:
>
> > > > > window.addEvent('domready', function()
> > > > > {
> > > > >         $('ajax_replace').addEvent('click', function(event)
> > > > >         {
> > > > >                 event.stop();
>
> > > > >                 var req = new Request(
> > > > >                 {
> > > > >                         method: 'get',
> > > > >                         url: $('ajax_replace').get('href'),
> > > > >                         data: { 'do' : '1' },
> > > > >                         onComplete: function(response)
> > > > >                         {
> > > > >                                 
> > > > > $('about_descriptioncontent').set('html', response);
> > > > >                         }
> > > > >                 }).send();
> > > > >         });
>
> > > > > });
>
> > > > > It now kinda works. I had an onRequest portion in there and that was
> > > > > triggering, and the content was changing, it was incredibly messed up
> > > > > (ie. wasn't outputting what I was expecting it to). However this only
> > > > > works for the first of my links, the other ones don't do anything at
> > > > > all.
>
> > > > > On Mar 9, 11:25 am, "Arak Tai'Roth"  wrote:
>
> > > > > > I don't want to do a simple GET request, I do want this as AJAX,
> > > > > > that's just the code I found. I am extremely new to MooTools, never
> > > > > > used it before this, in addition I am new to using AJAX period.
>
> > > > > > One thing I just realized and am slightly confused about. With the
> > > > > > code $('ajax_replace) I am under the understanding that I am
> > > > > > referencing the element id = ajax_replace. However I have multiples 
> > > > > > of
> > > > > > those on this page, 4 right now, likely more later once I have this
> > > > > > working. How does it know which one to add the event too (I want it
> > > > > > added to all of them) and how does it know which one to get the URL
> > > > > > from?
>
> > > > > > I am assuming it doesn't know, and might be the reason why things
> > > > > > aren't working.
>
> > > > > > On Mar 9, 11:06 am, mark_story  wrote:
>
> > > > > > > Well I would start with seeing if the Selector is working? does 
> > > > > > > the
> > > > > > > click event even fire? I use mootools quite often, and there is
> > > > > > > nothing in cake that prevents you from doing so. Why aren't you 
> > > > > > > just
> > > > > > > using Element.load() instead?  If you only want to do a simple GET
> > > > > > > request, I would just do
>
> > > > > > > window.addEvent('domready', function() {
> > > > > > >   $('ajax_replace').addEvent('click', function(event) {
> > > > > > >     event.stop();
> > > > > > >     $('about_descriptioncontent').load(this.get('href'));
> > > > > > >   }
>
> > > > > > > });
>
> > > > > > > Or you can keep your existing code, but you may want to prevent 
> > > > > > > the
> > > > > > > default browser action anyways.  As you won't see the ajax 
> > > > > > > result, as
> > > > > > > the default action will still

Re: MooTools Ajax with Cake

2009-03-11 Thread mark_story

No worries,  glad to hear you got it all sorted.  MooTools can have a
pretty steep learning curve, as it doesn't have as many one liners as
other libraries, but if you stick with it, there is a lot of power and
features under the hood.  As for neat shortcuts, look at
Element.implement() you can add on additional element shortcuts that
trigger effects.  The Chain class is also a really powerful and
interesting class.

-Mark

On Mar 10, 10:06 pm, "Arak Tai'Roth"  wrote:
> Also not to be an ass. But I have effects working, you are right there
> is tons of documentation. I was just checking if anyone had any cool
> ideas I hadn't thought of.
>
> I also did get it working just fine with multiple elements of the same
> name.
>
> Copy and pasting can lead to a lot of issues with no understanding I
> agree. However it gets you something to work on right away and gives
> you a more practical way to learn, and for me, that's far more useful.
>
> On Mar 10, 10:56 am, mark_story  wrote:
>
> > Not to be an ass, but mootools has tons of documentation, examples and
> > tutorials.  You can find lots of information on how you use effects in
> > the mootools docss.  Furthermore if you have more than one element
> > with the same ID don't expect anything to work properly.  In addition
> > Element.load() does do an AJAX request.  Just as a GET instead of a
> > POST type request.  But if you are new to Ajax and Mootools, I would
> > start with the docs, copy+pasting is going to lead to lots of these
> > type issues.
>
> > -Mark
>
> > On Mar 9, 4:39 pm, "Arak Tai'Roth"  wrote:
>
> > > Well it looks like I got it all working. Now I just need to figure out
> > > how to add some kind of effect to it. If anyone has any advice on
> > > that, that would be perfect.
>
> > > On Mar 9, 11:43 am, "Arak Tai'Roth"  wrote:
>
> > > > So I completely revamped the code in my ajax file to this:
>
> > > > window.addEvent('domready', function()
> > > > {
> > > >         $('ajax_replace').addEvent('click', function(event)
> > > >         {
> > > >                 event.stop();
>
> > > >                 var req = new Request(
> > > >                 {
> > > >                         method: 'get',
> > > >                         url: $('ajax_replace').get('href'),
> > > >                         data: { 'do' : '1' },
> > > >                         onComplete: function(response)
> > > >                         {
> > > >                                 
> > > > $('about_descriptioncontent').set('html', response);
> > > >                         }
> > > >                 }).send();
> > > >         });
>
> > > > });
>
> > > > It now kinda works. I had an onRequest portion in there and that was
> > > > triggering, and the content was changing, it was incredibly messed up
> > > > (ie. wasn't outputting what I was expecting it to). However this only
> > > > works for the first of my links, the other ones don't do anything at
> > > > all.
>
> > > > On Mar 9, 11:25 am, "Arak Tai'Roth"  wrote:
>
> > > > > I don't want to do a simple GET request, I do want this as AJAX,
> > > > > that's just the code I found. I am extremely new to MooTools, never
> > > > > used it before this, in addition I am new to using AJAX period.
>
> > > > > One thing I just realized and am slightly confused about. With the
> > > > > code $('ajax_replace) I am under the understanding that I am
> > > > > referencing the element id = ajax_replace. However I have multiples of
> > > > > those on this page, 4 right now, likely more later once I have this
> > > > > working. How does it know which one to add the event too (I want it
> > > > > added to all of them) and how does it know which one to get the URL
> > > > > from?
>
> > > > > I am assuming it doesn't know, and might be the reason why things
> > > > > aren't working.
>
> > > > > On Mar 9, 11:06 am, mark_story  wrote:
>
> > > > > > Well I would start with seeing if the Selector is working? does the
> > > > > > click event even fire? I use mootools quite often, and there is
> > > > > > nothing in cake that prevents you from doing so. Why aren't you just
> > > > > > using Element.load() instead?  If you only want to do a simple GET
> > > > > > request, I would just do
>
> > > > > > window.addEvent('domready', function() {
> > > > > >   $('ajax_replace').addEvent('click', function(event) {
> > > > > >     event.stop();
> > > > > >     $('about_descriptioncontent').load(this.get('href'));
> > > > > >   }
>
> > > > > > });
>
> > > > > > Or you can keep your existing code, but you may want to prevent the
> > > > > > default browser action anyways.  As you won't see the ajax result, 
> > > > > > as
> > > > > > the default action will still happen.
>
> > > > > > -Mark
>
> > > > > > On Mar 9, 12:03 pm, "Arak Tai'Roth"  
> > > > > > wrote:
>
> > > > > > > Also considering I am using multiple links I tried this as well:
>
> > > > > > > url: $$('a.ajax_replace').get('href'),
>
> > > > > > > and
>
> > > > > > > $$('a.ajax_replace').addEvent('cli

Re: MooTools Ajax with Cake

2009-03-10 Thread Arak Tai'Roth

Also not to be an ass. But I have effects working, you are right there
is tons of documentation. I was just checking if anyone had any cool
ideas I hadn't thought of.

I also did get it working just fine with multiple elements of the same
name.

Copy and pasting can lead to a lot of issues with no understanding I
agree. However it gets you something to work on right away and gives
you a more practical way to learn, and for me, that's far more useful.

On Mar 10, 10:56 am, mark_story  wrote:
> Not to be an ass, but mootools has tons of documentation, examples and
> tutorials.  You can find lots of information on how you use effects in
> the mootools docss.  Furthermore if you have more than one element
> with the same ID don't expect anything to work properly.  In addition
> Element.load() does do an AJAX request.  Just as a GET instead of a
> POST type request.  But if you are new to Ajax and Mootools, I would
> start with the docs, copy+pasting is going to lead to lots of these
> type issues.
>
> -Mark
>
> On Mar 9, 4:39 pm, "Arak Tai'Roth"  wrote:
>
> > Well it looks like I got it all working. Now I just need to figure out
> > how to add some kind of effect to it. If anyone has any advice on
> > that, that would be perfect.
>
> > On Mar 9, 11:43 am, "Arak Tai'Roth"  wrote:
>
> > > So I completely revamped the code in my ajax file to this:
>
> > > window.addEvent('domready', function()
> > > {
> > >         $('ajax_replace').addEvent('click', function(event)
> > >         {
> > >                 event.stop();
>
> > >                 var req = new Request(
> > >                 {
> > >                         method: 'get',
> > >                         url: $('ajax_replace').get('href'),
> > >                         data: { 'do' : '1' },
> > >                         onComplete: function(response)
> > >                         {
> > >                                 $('about_descriptioncontent').set('html', 
> > > response);
> > >                         }
> > >                 }).send();
> > >         });
>
> > > });
>
> > > It now kinda works. I had an onRequest portion in there and that was
> > > triggering, and the content was changing, it was incredibly messed up
> > > (ie. wasn't outputting what I was expecting it to). However this only
> > > works for the first of my links, the other ones don't do anything at
> > > all.
>
> > > On Mar 9, 11:25 am, "Arak Tai'Roth"  wrote:
>
> > > > I don't want to do a simple GET request, I do want this as AJAX,
> > > > that's just the code I found. I am extremely new to MooTools, never
> > > > used it before this, in addition I am new to using AJAX period.
>
> > > > One thing I just realized and am slightly confused about. With the
> > > > code $('ajax_replace) I am under the understanding that I am
> > > > referencing the element id = ajax_replace. However I have multiples of
> > > > those on this page, 4 right now, likely more later once I have this
> > > > working. How does it know which one to add the event too (I want it
> > > > added to all of them) and how does it know which one to get the URL
> > > > from?
>
> > > > I am assuming it doesn't know, and might be the reason why things
> > > > aren't working.
>
> > > > On Mar 9, 11:06 am, mark_story  wrote:
>
> > > > > Well I would start with seeing if the Selector is working? does the
> > > > > click event even fire? I use mootools quite often, and there is
> > > > > nothing in cake that prevents you from doing so. Why aren't you just
> > > > > using Element.load() instead?  If you only want to do a simple GET
> > > > > request, I would just do
>
> > > > > window.addEvent('domready', function() {
> > > > >   $('ajax_replace').addEvent('click', function(event) {
> > > > >     event.stop();
> > > > >     $('about_descriptioncontent').load(this.get('href'));
> > > > >   }
>
> > > > > });
>
> > > > > Or you can keep your existing code, but you may want to prevent the
> > > > > default browser action anyways.  As you won't see the ajax result, as
> > > > > the default action will still happen.
>
> > > > > -Mark
>
> > > > > On Mar 9, 12:03 pm, "Arak Tai'Roth"  wrote:
>
> > > > > > Also considering I am using multiple links I tried this as well:
>
> > > > > > url: $$('a.ajax_replace').get('href'),
>
> > > > > > and
>
> > > > > > $$('a.ajax_replace').addEvent('click', function()
>
> > > > > > and then changing the id's to classes. I was thinking this might 
> > > > > > work,
> > > > > > but alas, it did not either.
>
> > > > > > On Mar 9, 9:19 am, "Arak Tai'Roth"  wrote:
>
> > > > > > > Yea, I'm sorry, I had fixed that problem a little while ago, that
> > > > > > > isn't the solution to the problem, it's still not working, and the
> > > > > > > page is still trying to load instead of working via AJAX.
>
> > > > > > > This is my code for the buttons I am making if that makes a
> > > > > > > difference.
>
> > > > > > > echo $html->link($html->image('/img/about/uploads/thumb.small.' .
> > > > > > > $links['About']['pict

Re: MooTools Ajax with Cake

2009-03-10 Thread mark_story

Not to be an ass, but mootools has tons of documentation, examples and
tutorials.  You can find lots of information on how you use effects in
the mootools docss.  Furthermore if you have more than one element
with the same ID don't expect anything to work properly.  In addition
Element.load() does do an AJAX request.  Just as a GET instead of a
POST type request.  But if you are new to Ajax and Mootools, I would
start with the docs, copy+pasting is going to lead to lots of these
type issues.

-Mark

On Mar 9, 4:39 pm, "Arak Tai'Roth"  wrote:
> Well it looks like I got it all working. Now I just need to figure out
> how to add some kind of effect to it. If anyone has any advice on
> that, that would be perfect.
>
> On Mar 9, 11:43 am, "Arak Tai'Roth"  wrote:
>
> > So I completely revamped the code in my ajax file to this:
>
> > window.addEvent('domready', function()
> > {
> >         $('ajax_replace').addEvent('click', function(event)
> >         {
> >                 event.stop();
>
> >                 var req = new Request(
> >                 {
> >                         method: 'get',
> >                         url: $('ajax_replace').get('href'),
> >                         data: { 'do' : '1' },
> >                         onComplete: function(response)
> >                         {
> >                                 $('about_descriptioncontent').set('html', 
> > response);
> >                         }
> >                 }).send();
> >         });
>
> > });
>
> > It now kinda works. I had an onRequest portion in there and that was
> > triggering, and the content was changing, it was incredibly messed up
> > (ie. wasn't outputting what I was expecting it to). However this only
> > works for the first of my links, the other ones don't do anything at
> > all.
>
> > On Mar 9, 11:25 am, "Arak Tai'Roth"  wrote:
>
> > > I don't want to do a simple GET request, I do want this as AJAX,
> > > that's just the code I found. I am extremely new to MooTools, never
> > > used it before this, in addition I am new to using AJAX period.
>
> > > One thing I just realized and am slightly confused about. With the
> > > code $('ajax_replace) I am under the understanding that I am
> > > referencing the element id = ajax_replace. However I have multiples of
> > > those on this page, 4 right now, likely more later once I have this
> > > working. How does it know which one to add the event too (I want it
> > > added to all of them) and how does it know which one to get the URL
> > > from?
>
> > > I am assuming it doesn't know, and might be the reason why things
> > > aren't working.
>
> > > On Mar 9, 11:06 am, mark_story  wrote:
>
> > > > Well I would start with seeing if the Selector is working? does the
> > > > click event even fire? I use mootools quite often, and there is
> > > > nothing in cake that prevents you from doing so. Why aren't you just
> > > > using Element.load() instead?  If you only want to do a simple GET
> > > > request, I would just do
>
> > > > window.addEvent('domready', function() {
> > > >   $('ajax_replace').addEvent('click', function(event) {
> > > >     event.stop();
> > > >     $('about_descriptioncontent').load(this.get('href'));
> > > >   }
>
> > > > });
>
> > > > Or you can keep your existing code, but you may want to prevent the
> > > > default browser action anyways.  As you won't see the ajax result, as
> > > > the default action will still happen.
>
> > > > -Mark
>
> > > > On Mar 9, 12:03 pm, "Arak Tai'Roth"  wrote:
>
> > > > > Also considering I am using multiple links I tried this as well:
>
> > > > > url: $$('a.ajax_replace').get('href'),
>
> > > > > and
>
> > > > > $$('a.ajax_replace').addEvent('click', function()
>
> > > > > and then changing the id's to classes. I was thinking this might work,
> > > > > but alas, it did not either.
>
> > > > > On Mar 9, 9:19 am, "Arak Tai'Roth"  wrote:
>
> > > > > > Yea, I'm sorry, I had fixed that problem a little while ago, that
> > > > > > isn't the solution to the problem, it's still not working, and the
> > > > > > page is still trying to load instead of working via AJAX.
>
> > > > > > This is my code for the buttons I am making if that makes a
> > > > > > difference.
>
> > > > > > echo $html->link($html->image('/img/about/uploads/thumb.small.' .
> > > > > > $links['About']['picture'], array('alt' => 
> > > > > > $links['About']['name'])),
> > > > > > '/about/view/' . $links['About']['id'], array('id' => 
> > > > > > 'ajax_replace'),
> > > > > > false, false)
>
> > > > > > I'm not so sure the problem is with the javascript, I mean it 
> > > > > > totally
> > > > > > could be, however I have found a few AJAX tutorials in MooTools, and
> > > > > > the code I have is relatively copied. However I have found no
> > > > > > tutorials anywhere regarding using MooTools AJAX with CakePHP, so
> > > > > > what's really bothering me is the setting up the controller and how
> > > > > > the associated view(s) should be set up.
>
> > > > > > On Mar 9, 3:10 a

Re: MooTools Ajax with Cake

2009-03-10 Thread r4zv4n

Inside #about_desctriptioncontent you can add another div which you
will fade in :)

On Mar 9, 10:39 pm, "Arak Tai'Roth"  wrote:
> Well it looks like I got it all working. Now I just need to figure out
> how to add some kind of effect to it. If anyone has any advice on
> that, that would be perfect.
>
> On Mar 9, 11:43 am, "Arak Tai'Roth"  wrote:
>
> > So I completely revamped the code in my ajax file to this:
>
> > window.addEvent('domready', function()
> > {
> >         $('ajax_replace').addEvent('click', function(event)
> >         {
> >                 event.stop();
>
> >                 var req = new Request(
> >                 {
> >                         method: 'get',
> >                         url: $('ajax_replace').get('href'),
> >                         data: { 'do' : '1' },
> >                         onComplete: function(response)
> >                         {
> >                                 $('about_descriptioncontent').set('html', 
> > response);
> >                         }
> >                 }).send();
> >         });
>
> > });
>
> > It now kinda works. I had an onRequest portion in there and that was
> > triggering, and the content was changing, it was incredibly messed up
> > (ie. wasn't outputting what I was expecting it to). However this only
> > works for the first of my links, the other ones don't do anything at
> > all.
>
> > On Mar 9, 11:25 am, "Arak Tai'Roth"  wrote:
>
> > > I don't want to do a simple GET request, I do want this as AJAX,
> > > that's just the code I found. I am extremely new to MooTools, never
> > > used it before this, in addition I am new to using AJAX period.
>
> > > One thing I just realized and am slightly confused about. With the
> > > code $('ajax_replace) I am under the understanding that I am
> > > referencing the element id = ajax_replace. However I have multiples of
> > > those on this page, 4 right now, likely more later once I have this
> > > working. How does it know which one to add the event too (I want it
> > > added to all of them) and how does it know which one to get the URL
> > > from?
>
> > > I am assuming it doesn't know, and might be the reason why things
> > > aren't working.
>
> > > On Mar 9, 11:06 am, mark_story  wrote:
>
> > > > Well I would start with seeing if the Selector is working? does the
> > > > click event even fire? I use mootools quite often, and there is
> > > > nothing in cake that prevents you from doing so. Why aren't you just
> > > > using Element.load() instead?  If you only want to do a simple GET
> > > > request, I would just do
>
> > > > window.addEvent('domready', function() {
> > > >   $('ajax_replace').addEvent('click', function(event) {
> > > >     event.stop();
> > > >     $('about_descriptioncontent').load(this.get('href'));
> > > >   }
>
> > > > });
>
> > > > Or you can keep your existing code, but you may want to prevent the
> > > > default browser action anyways.  As you won't see the ajax result, as
> > > > the default action will still happen.
>
> > > > -Mark
>
> > > > On Mar 9, 12:03 pm, "Arak Tai'Roth"  wrote:
>
> > > > > Also considering I am using multiple links I tried this as well:
>
> > > > > url: $$('a.ajax_replace').get('href'),
>
> > > > > and
>
> > > > > $$('a.ajax_replace').addEvent('click', function()
>
> > > > > and then changing the id's to classes. I was thinking this might work,
> > > > > but alas, it did not either.
>
> > > > > On Mar 9, 9:19 am, "Arak Tai'Roth"  wrote:
>
> > > > > > Yea, I'm sorry, I had fixed that problem a little while ago, that
> > > > > > isn't the solution to the problem, it's still not working, and the
> > > > > > page is still trying to load instead of working via AJAX.
>
> > > > > > This is my code for the buttons I am making if that makes a
> > > > > > difference.
>
> > > > > > echo $html->link($html->image('/img/about/uploads/thumb.small.' .
> > > > > > $links['About']['picture'], array('alt' => 
> > > > > > $links['About']['name'])),
> > > > > > '/about/view/' . $links['About']['id'], array('id' => 
> > > > > > 'ajax_replace'),
> > > > > > false, false)
>
> > > > > > I'm not so sure the problem is with the javascript, I mean it 
> > > > > > totally
> > > > > > could be, however I have found a few AJAX tutorials in MooTools, and
> > > > > > the code I have is relatively copied. However I have found no
> > > > > > tutorials anywhere regarding using MooTools AJAX with CakePHP, so
> > > > > > what's really bothering me is the setting up the controller and how
> > > > > > the associated view(s) should be set up.
>
> > > > > > On Mar 9, 3:10 am, r4zv4n  wrote:
>
> > > > > > > Hi,
>
> > > > > > > The fact that the page is loading instead of the Ajax request 
> > > > > > > being
> > > > > > > sent should signal that there's an error in your JS (if it were a 
> > > > > > > Cake
> > > > > > > err, you would have had weird responses).
>
> > > > > > > Upon closer inspection, here is the problem:
>
> > > > > > > $('ajax_replace').addEvent('click', function(
> >

Re: MooTools Ajax with Cake

2009-03-09 Thread Arak Tai'Roth

Well it looks like I got it all working. Now I just need to figure out
how to add some kind of effect to it. If anyone has any advice on
that, that would be perfect.

On Mar 9, 11:43 am, "Arak Tai'Roth"  wrote:
> So I completely revamped the code in my ajax file to this:
>
> window.addEvent('domready', function()
> {
>         $('ajax_replace').addEvent('click', function(event)
>         {
>                 event.stop();
>
>                 var req = new Request(
>                 {
>                         method: 'get',
>                         url: $('ajax_replace').get('href'),
>                         data: { 'do' : '1' },
>                         onComplete: function(response)
>                         {
>                                 $('about_descriptioncontent').set('html', 
> response);
>                         }
>                 }).send();
>         });
>
> });
>
> It now kinda works. I had an onRequest portion in there and that was
> triggering, and the content was changing, it was incredibly messed up
> (ie. wasn't outputting what I was expecting it to). However this only
> works for the first of my links, the other ones don't do anything at
> all.
>
> On Mar 9, 11:25 am, "Arak Tai'Roth"  wrote:
>
> > I don't want to do a simple GET request, I do want this as AJAX,
> > that's just the code I found. I am extremely new to MooTools, never
> > used it before this, in addition I am new to using AJAX period.
>
> > One thing I just realized and am slightly confused about. With the
> > code $('ajax_replace) I am under the understanding that I am
> > referencing the element id = ajax_replace. However I have multiples of
> > those on this page, 4 right now, likely more later once I have this
> > working. How does it know which one to add the event too (I want it
> > added to all of them) and how does it know which one to get the URL
> > from?
>
> > I am assuming it doesn't know, and might be the reason why things
> > aren't working.
>
> > On Mar 9, 11:06 am, mark_story  wrote:
>
> > > Well I would start with seeing if the Selector is working? does the
> > > click event even fire? I use mootools quite often, and there is
> > > nothing in cake that prevents you from doing so. Why aren't you just
> > > using Element.load() instead?  If you only want to do a simple GET
> > > request, I would just do
>
> > > window.addEvent('domready', function() {
> > >   $('ajax_replace').addEvent('click', function(event) {
> > >     event.stop();
> > >     $('about_descriptioncontent').load(this.get('href'));
> > >   }
>
> > > });
>
> > > Or you can keep your existing code, but you may want to prevent the
> > > default browser action anyways.  As you won't see the ajax result, as
> > > the default action will still happen.
>
> > > -Mark
>
> > > On Mar 9, 12:03 pm, "Arak Tai'Roth"  wrote:
>
> > > > Also considering I am using multiple links I tried this as well:
>
> > > > url: $$('a.ajax_replace').get('href'),
>
> > > > and
>
> > > > $$('a.ajax_replace').addEvent('click', function()
>
> > > > and then changing the id's to classes. I was thinking this might work,
> > > > but alas, it did not either.
>
> > > > On Mar 9, 9:19 am, "Arak Tai'Roth"  wrote:
>
> > > > > Yea, I'm sorry, I had fixed that problem a little while ago, that
> > > > > isn't the solution to the problem, it's still not working, and the
> > > > > page is still trying to load instead of working via AJAX.
>
> > > > > This is my code for the buttons I am making if that makes a
> > > > > difference.
>
> > > > > echo $html->link($html->image('/img/about/uploads/thumb.small.' .
> > > > > $links['About']['picture'], array('alt' => $links['About']['name'])),
> > > > > '/about/view/' . $links['About']['id'], array('id' => 'ajax_replace'),
> > > > > false, false)
>
> > > > > I'm not so sure the problem is with the javascript, I mean it totally
> > > > > could be, however I have found a few AJAX tutorials in MooTools, and
> > > > > the code I have is relatively copied. However I have found no
> > > > > tutorials anywhere regarding using MooTools AJAX with CakePHP, so
> > > > > what's really bothering me is the setting up the controller and how
> > > > > the associated view(s) should be set up.
>
> > > > > On Mar 9, 3:10 am, r4zv4n  wrote:
>
> > > > > > Hi,
>
> > > > > > The fact that the page is loading instead of the Ajax request being
> > > > > > sent should signal that there's an error in your JS (if it were a 
> > > > > > Cake
> > > > > > err, you would have had weird responses).
>
> > > > > > Upon closer inspection, here is the problem:
>
> > > > > > $('ajax_replace').addEvent('click', function(
> > > > > >         {
> > > > > >                 req.send();
> > > > > >         });
>
> > > > > > ..should actually be:
>
> > > > > > $('ajax_replace').addEvent('click', function()
> > > > > >         {
> > > > > >                 req.send();
> > > > > >         });
>
> > > > > > (you simply missed a closing parenthesis)
>
> > > > > > Tip: use Firefox with Fire

Re: MooTools Ajax with Cake

2009-03-09 Thread Arak Tai'Roth

So I completely revamped the code in my ajax file to this:

window.addEvent('domready', function()
{
$('ajax_replace').addEvent('click', function(event)
{
event.stop();

var req = new Request(
{
method: 'get',
url: $('ajax_replace').get('href'),
data: { 'do' : '1' },
onComplete: function(response)
{
$('about_descriptioncontent').set('html', 
response);
}
}).send();
});
});

It now kinda works. I had an onRequest portion in there and that was
triggering, and the content was changing, it was incredibly messed up
(ie. wasn't outputting what I was expecting it to). However this only
works for the first of my links, the other ones don't do anything at
all.

On Mar 9, 11:25 am, "Arak Tai'Roth"  wrote:
> I don't want to do a simple GET request, I do want this as AJAX,
> that's just the code I found. I am extremely new to MooTools, never
> used it before this, in addition I am new to using AJAX period.
>
> One thing I just realized and am slightly confused about. With the
> code $('ajax_replace) I am under the understanding that I am
> referencing the element id = ajax_replace. However I have multiples of
> those on this page, 4 right now, likely more later once I have this
> working. How does it know which one to add the event too (I want it
> added to all of them) and how does it know which one to get the URL
> from?
>
> I am assuming it doesn't know, and might be the reason why things
> aren't working.
>
> On Mar 9, 11:06 am, mark_story  wrote:
>
> > Well I would start with seeing if the Selector is working? does the
> > click event even fire? I use mootools quite often, and there is
> > nothing in cake that prevents you from doing so. Why aren't you just
> > using Element.load() instead?  If you only want to do a simple GET
> > request, I would just do
>
> > window.addEvent('domready', function() {
> >   $('ajax_replace').addEvent('click', function(event) {
> >     event.stop();
> >     $('about_descriptioncontent').load(this.get('href'));
> >   }
>
> > });
>
> > Or you can keep your existing code, but you may want to prevent the
> > default browser action anyways.  As you won't see the ajax result, as
> > the default action will still happen.
>
> > -Mark
>
> > On Mar 9, 12:03 pm, "Arak Tai'Roth"  wrote:
>
> > > Also considering I am using multiple links I tried this as well:
>
> > > url: $$('a.ajax_replace').get('href'),
>
> > > and
>
> > > $$('a.ajax_replace').addEvent('click', function()
>
> > > and then changing the id's to classes. I was thinking this might work,
> > > but alas, it did not either.
>
> > > On Mar 9, 9:19 am, "Arak Tai'Roth"  wrote:
>
> > > > Yea, I'm sorry, I had fixed that problem a little while ago, that
> > > > isn't the solution to the problem, it's still not working, and the
> > > > page is still trying to load instead of working via AJAX.
>
> > > > This is my code for the buttons I am making if that makes a
> > > > difference.
>
> > > > echo $html->link($html->image('/img/about/uploads/thumb.small.' .
> > > > $links['About']['picture'], array('alt' => $links['About']['name'])),
> > > > '/about/view/' . $links['About']['id'], array('id' => 'ajax_replace'),
> > > > false, false)
>
> > > > I'm not so sure the problem is with the javascript, I mean it totally
> > > > could be, however I have found a few AJAX tutorials in MooTools, and
> > > > the code I have is relatively copied. However I have found no
> > > > tutorials anywhere regarding using MooTools AJAX with CakePHP, so
> > > > what's really bothering me is the setting up the controller and how
> > > > the associated view(s) should be set up.
>
> > > > On Mar 9, 3:10 am, r4zv4n  wrote:
>
> > > > > Hi,
>
> > > > > The fact that the page is loading instead of the Ajax request being
> > > > > sent should signal that there's an error in your JS (if it were a Cake
> > > > > err, you would have had weird responses).
>
> > > > > Upon closer inspection, here is the problem:
>
> > > > > $('ajax_replace').addEvent('click', function(
> > > > >         {
> > > > >                 req.send();
> > > > >         });
>
> > > > > ..should actually be:
>
> > > > > $('ajax_replace').addEvent('click', function()
> > > > >         {
> > > > >                 req.send();
> > > > >         });
>
> > > > > (you simply missed a closing parenthesis)
>
> > > > > Tip: use Firefox with FireBug  - you would have seen the error
> > > > > sooner ;)
>
> > > > > On Mar 9, 12:36 am, "Arak Tai'Roth"  wrote:
>
> > > > > > I tried that, and removed my autoRender and exit() lines and added 
> > > > > > in
> > > > > > $this->render(index); It didn't work.
>
> > > > > > The page is still loading, which it shouldn't be with an AJAX 
> > > > > > request
> > > > > > as far as I know.
>
> > > > > > In addition I add

Re: MooTools Ajax with Cake

2009-03-09 Thread Arak Tai'Roth

I don't want to do a simple GET request, I do want this as AJAX,
that's just the code I found. I am extremely new to MooTools, never
used it before this, in addition I am new to using AJAX period.

One thing I just realized and am slightly confused about. With the
code $('ajax_replace) I am under the understanding that I am
referencing the element id = ajax_replace. However I have multiples of
those on this page, 4 right now, likely more later once I have this
working. How does it know which one to add the event too (I want it
added to all of them) and how does it know which one to get the URL
from?

I am assuming it doesn't know, and might be the reason why things
aren't working.

On Mar 9, 11:06 am, mark_story  wrote:
> Well I would start with seeing if the Selector is working? does the
> click event even fire? I use mootools quite often, and there is
> nothing in cake that prevents you from doing so. Why aren't you just
> using Element.load() instead?  If you only want to do a simple GET
> request, I would just do
>
> window.addEvent('domready', function() {
>   $('ajax_replace').addEvent('click', function(event) {
>     event.stop();
>     $('about_descriptioncontent').load(this.get('href'));
>   }
>
> });
>
> Or you can keep your existing code, but you may want to prevent the
> default browser action anyways.  As you won't see the ajax result, as
> the default action will still happen.
>
> -Mark
>
> On Mar 9, 12:03 pm, "Arak Tai'Roth"  wrote:
>
> > Also considering I am using multiple links I tried this as well:
>
> > url: $$('a.ajax_replace').get('href'),
>
> > and
>
> > $$('a.ajax_replace').addEvent('click', function()
>
> > and then changing the id's to classes. I was thinking this might work,
> > but alas, it did not either.
>
> > On Mar 9, 9:19 am, "Arak Tai'Roth"  wrote:
>
> > > Yea, I'm sorry, I had fixed that problem a little while ago, that
> > > isn't the solution to the problem, it's still not working, and the
> > > page is still trying to load instead of working via AJAX.
>
> > > This is my code for the buttons I am making if that makes a
> > > difference.
>
> > > echo $html->link($html->image('/img/about/uploads/thumb.small.' .
> > > $links['About']['picture'], array('alt' => $links['About']['name'])),
> > > '/about/view/' . $links['About']['id'], array('id' => 'ajax_replace'),
> > > false, false)
>
> > > I'm not so sure the problem is with the javascript, I mean it totally
> > > could be, however I have found a few AJAX tutorials in MooTools, and
> > > the code I have is relatively copied. However I have found no
> > > tutorials anywhere regarding using MooTools AJAX with CakePHP, so
> > > what's really bothering me is the setting up the controller and how
> > > the associated view(s) should be set up.
>
> > > On Mar 9, 3:10 am, r4zv4n  wrote:
>
> > > > Hi,
>
> > > > The fact that the page is loading instead of the Ajax request being
> > > > sent should signal that there's an error in your JS (if it were a Cake
> > > > err, you would have had weird responses).
>
> > > > Upon closer inspection, here is the problem:
>
> > > > $('ajax_replace').addEvent('click', function(
> > > >         {
> > > >                 req.send();
> > > >         });
>
> > > > ..should actually be:
>
> > > > $('ajax_replace').addEvent('click', function()
> > > >         {
> > > >                 req.send();
> > > >         });
>
> > > > (you simply missed a closing parenthesis)
>
> > > > Tip: use Firefox with FireBug  - you would have seen the error
> > > > sooner ;)
>
> > > > On Mar 9, 12:36 am, "Arak Tai'Roth"  wrote:
>
> > > > > I tried that, and removed my autoRender and exit() lines and added in
> > > > > $this->render(index); It didn't work.
>
> > > > > The page is still loading, which it shouldn't be with an AJAX request
> > > > > as far as I know.
>
> > > > > In addition I added a $this->Session->setFlash('message'); inside the
> > > > > isAjax() if statement and it doesn't pop up.
>
> > > > > I should also say that I have multiples of these links
> > > > > ('ajax_replace'), not just one, if that makes a difference.
>
> > > > > As well, I have two views right now, I have my index.ctp view which is
> > > > > displaying the links and the first content that comes up (a picture
> > > > > and some text), then I have my vew.ctp which currently is only holding
> > > > > the content that I want to show where the current picture and text is.
> > > > > So I'm not entirely sure if I even have this setup correctly.
>
> > > > > On Mar 8, 3:17 pm, "Websta*" 
> > > > > wrote:
>
> > > > > > Assuming your request is running - and i can see no reason why it
> > > > > > wouldnt as long as you have the correct html elements in use then i
> > > > > > suspect your problem lies here:
>
> > > > > > $this->autoRender = false;
> > > > > > exit();
>
> > > > > > By doing this your teling your controller not to render after the
> > > > > > action, and then your exiting so nothing at all gets output.
>
> > > > > > So either get rid o

Re: MooTools Ajax with Cake

2009-03-09 Thread mark_story

Well I would start with seeing if the Selector is working? does the
click event even fire? I use mootools quite often, and there is
nothing in cake that prevents you from doing so. Why aren't you just
using Element.load() instead?  If you only want to do a simple GET
request, I would just do

window.addEvent('domready', function() {
  $('ajax_replace').addEvent('click', function(event) {
event.stop();
$('about_descriptioncontent').load(this.get('href'));
  }
});

Or you can keep your existing code, but you may want to prevent the
default browser action anyways.  As you won't see the ajax result, as
the default action will still happen.

-Mark

On Mar 9, 12:03 pm, "Arak Tai'Roth"  wrote:
> Also considering I am using multiple links I tried this as well:
>
> url: $$('a.ajax_replace').get('href'),
>
> and
>
> $$('a.ajax_replace').addEvent('click', function()
>
> and then changing the id's to classes. I was thinking this might work,
> but alas, it did not either.
>
> On Mar 9, 9:19 am, "Arak Tai'Roth"  wrote:
>
> > Yea, I'm sorry, I had fixed that problem a little while ago, that
> > isn't the solution to the problem, it's still not working, and the
> > page is still trying to load instead of working via AJAX.
>
> > This is my code for the buttons I am making if that makes a
> > difference.
>
> > echo $html->link($html->image('/img/about/uploads/thumb.small.' .
> > $links['About']['picture'], array('alt' => $links['About']['name'])),
> > '/about/view/' . $links['About']['id'], array('id' => 'ajax_replace'),
> > false, false)
>
> > I'm not so sure the problem is with the javascript, I mean it totally
> > could be, however I have found a few AJAX tutorials in MooTools, and
> > the code I have is relatively copied. However I have found no
> > tutorials anywhere regarding using MooTools AJAX with CakePHP, so
> > what's really bothering me is the setting up the controller and how
> > the associated view(s) should be set up.
>
> > On Mar 9, 3:10 am, r4zv4n  wrote:
>
> > > Hi,
>
> > > The fact that the page is loading instead of the Ajax request being
> > > sent should signal that there's an error in your JS (if it were a Cake
> > > err, you would have had weird responses).
>
> > > Upon closer inspection, here is the problem:
>
> > > $('ajax_replace').addEvent('click', function(
> > >         {
> > >                 req.send();
> > >         });
>
> > > ..should actually be:
>
> > > $('ajax_replace').addEvent('click', function()
> > >         {
> > >                 req.send();
> > >         });
>
> > > (you simply missed a closing parenthesis)
>
> > > Tip: use Firefox with FireBug  - you would have seen the error
> > > sooner ;)
>
> > > On Mar 9, 12:36 am, "Arak Tai'Roth"  wrote:
>
> > > > I tried that, and removed my autoRender and exit() lines and added in
> > > > $this->render(index); It didn't work.
>
> > > > The page is still loading, which it shouldn't be with an AJAX request
> > > > as far as I know.
>
> > > > In addition I added a $this->Session->setFlash('message'); inside the
> > > > isAjax() if statement and it doesn't pop up.
>
> > > > I should also say that I have multiples of these links
> > > > ('ajax_replace'), not just one, if that makes a difference.
>
> > > > As well, I have two views right now, I have my index.ctp view which is
> > > > displaying the links and the first content that comes up (a picture
> > > > and some text), then I have my vew.ctp which currently is only holding
> > > > the content that I want to show where the current picture and text is.
> > > > So I'm not entirely sure if I even have this setup correctly.
>
> > > > On Mar 8, 3:17 pm, "Websta*" 
> > > > wrote:
>
> > > > > Assuming your request is running - and i can see no reason why it
> > > > > wouldnt as long as you have the correct html elements in use then i
> > > > > suspect your problem lies here:
>
> > > > > $this->autoRender = false;
> > > > > exit();
>
> > > > > By doing this your teling your controller not to render after the
> > > > > action, and then your exiting so nothing at all gets output.
>
> > > > > So either get rid of those lines altogether or if you want to forcibly
> > > > > render a specific view replace it with $this->render(myView);
>
> > > > > hth
>
> > > > > Paul
>
> > > > > On Mar 8, 6:09 pm, "Arak Tai'Roth"  wrote:
>
> > > > > > I am trying to update a div via ajax, however I am using MooTools, 
> > > > > > and
> > > > > > not the normal Prototype and Scriptaculous.
>
> > > > > > Here is the code that I have in my controller:
> > > > > > function view($id)
> > > > > >                 {
> > > > > >                         if ($this->RequestHandler->isAjax())
> > > > > >                         {
> > > > > >                                 $dbabout = 
> > > > > > $this->About->find('first', array(
> > > > > >                                         'conditions' => array(
> > > > > >                                                 'About.id' => $id
> > > > > >                                

Re: MooTools Ajax with Cake

2009-03-09 Thread Arak Tai'Roth

Also considering I am using multiple links I tried this as well:

url: $$('a.ajax_replace').get('href'),

and

$$('a.ajax_replace').addEvent('click', function()

and then changing the id's to classes. I was thinking this might work,
but alas, it did not either.

On Mar 9, 9:19 am, "Arak Tai'Roth"  wrote:
> Yea, I'm sorry, I had fixed that problem a little while ago, that
> isn't the solution to the problem, it's still not working, and the
> page is still trying to load instead of working via AJAX.
>
> This is my code for the buttons I am making if that makes a
> difference.
>
> echo $html->link($html->image('/img/about/uploads/thumb.small.' .
> $links['About']['picture'], array('alt' => $links['About']['name'])),
> '/about/view/' . $links['About']['id'], array('id' => 'ajax_replace'),
> false, false)
>
> I'm not so sure the problem is with the javascript, I mean it totally
> could be, however I have found a few AJAX tutorials in MooTools, and
> the code I have is relatively copied. However I have found no
> tutorials anywhere regarding using MooTools AJAX with CakePHP, so
> what's really bothering me is the setting up the controller and how
> the associated view(s) should be set up.
>
> On Mar 9, 3:10 am, r4zv4n  wrote:
>
> > Hi,
>
> > The fact that the page is loading instead of the Ajax request being
> > sent should signal that there's an error in your JS (if it were a Cake
> > err, you would have had weird responses).
>
> > Upon closer inspection, here is the problem:
>
> > $('ajax_replace').addEvent('click', function(
> >         {
> >                 req.send();
> >         });
>
> > ..should actually be:
>
> > $('ajax_replace').addEvent('click', function()
> >         {
> >                 req.send();
> >         });
>
> > (you simply missed a closing parenthesis)
>
> > Tip: use Firefox with FireBug  - you would have seen the error
> > sooner ;)
>
> > On Mar 9, 12:36 am, "Arak Tai'Roth"  wrote:
>
> > > I tried that, and removed my autoRender and exit() lines and added in
> > > $this->render(index); It didn't work.
>
> > > The page is still loading, which it shouldn't be with an AJAX request
> > > as far as I know.
>
> > > In addition I added a $this->Session->setFlash('message'); inside the
> > > isAjax() if statement and it doesn't pop up.
>
> > > I should also say that I have multiples of these links
> > > ('ajax_replace'), not just one, if that makes a difference.
>
> > > As well, I have two views right now, I have my index.ctp view which is
> > > displaying the links and the first content that comes up (a picture
> > > and some text), then I have my vew.ctp which currently is only holding
> > > the content that I want to show where the current picture and text is.
> > > So I'm not entirely sure if I even have this setup correctly.
>
> > > On Mar 8, 3:17 pm, "Websta*" 
> > > wrote:
>
> > > > Assuming your request is running - and i can see no reason why it
> > > > wouldnt as long as you have the correct html elements in use then i
> > > > suspect your problem lies here:
>
> > > > $this->autoRender = false;
> > > > exit();
>
> > > > By doing this your teling your controller not to render after the
> > > > action, and then your exiting so nothing at all gets output.
>
> > > > So either get rid of those lines altogether or if you want to forcibly
> > > > render a specific view replace it with $this->render(myView);
>
> > > > hth
>
> > > > Paul
>
> > > > On Mar 8, 6:09 pm, "Arak Tai'Roth"  wrote:
>
> > > > > I am trying to update a div via ajax, however I am using MooTools, and
> > > > > not the normal Prototype and Scriptaculous.
>
> > > > > Here is the code that I have in my controller:
> > > > > function view($id)
> > > > >                 {
> > > > >                         if ($this->RequestHandler->isAjax())
> > > > >                         {
> > > > >                                 $dbabout = 
> > > > > $this->About->find('first', array(
> > > > >                                         'conditions' => array(
> > > > >                                                 'About.id' => $id
> > > > >                                         ),
> > > > >                                         'fields' => array(
> > > > >                                                 'About.id', 
> > > > > 'About.name', 'About.picture', 'About.description'
> > > > >                                         )
> > > > >                                 ));
> > > > >                                 $this->set('dbabout', $dbabout);
>
> > > > >                                 Configure::write('debug', 0);
> > > > >                                 $this->autoRender = false;
>
> > > > >                                 exit();
> > > > >                         }
> > > > >                         else
> > > > >                         {
> > > > >                                 $this->redirect('/about/');
> > > > >                                 $this->exit();
> > > > >                         }
> > > > >                 }
>

Re: MooTools Ajax with Cake

2009-03-09 Thread Arak Tai'Roth

Yea, I'm sorry, I had fixed that problem a little while ago, that
isn't the solution to the problem, it's still not working, and the
page is still trying to load instead of working via AJAX.

This is my code for the buttons I am making if that makes a
difference.

echo $html->link($html->image('/img/about/uploads/thumb.small.' .
$links['About']['picture'], array('alt' => $links['About']['name'])),
'/about/view/' . $links['About']['id'], array('id' => 'ajax_replace'),
false, false)

I'm not so sure the problem is with the javascript, I mean it totally
could be, however I have found a few AJAX tutorials in MooTools, and
the code I have is relatively copied. However I have found no
tutorials anywhere regarding using MooTools AJAX with CakePHP, so
what's really bothering me is the setting up the controller and how
the associated view(s) should be set up.

On Mar 9, 3:10 am, r4zv4n  wrote:
> Hi,
>
> The fact that the page is loading instead of the Ajax request being
> sent should signal that there's an error in your JS (if it were a Cake
> err, you would have had weird responses).
>
> Upon closer inspection, here is the problem:
>
> $('ajax_replace').addEvent('click', function(
>         {
>                 req.send();
>         });
>
> ..should actually be:
>
> $('ajax_replace').addEvent('click', function()
>         {
>                 req.send();
>         });
>
> (you simply missed a closing parenthesis)
>
> Tip: use Firefox with FireBug  - you would have seen the error
> sooner ;)
>
> On Mar 9, 12:36 am, "Arak Tai'Roth"  wrote:
>
> > I tried that, and removed my autoRender and exit() lines and added in
> > $this->render(index); It didn't work.
>
> > The page is still loading, which it shouldn't be with an AJAX request
> > as far as I know.
>
> > In addition I added a $this->Session->setFlash('message'); inside the
> > isAjax() if statement and it doesn't pop up.
>
> > I should also say that I have multiples of these links
> > ('ajax_replace'), not just one, if that makes a difference.
>
> > As well, I have two views right now, I have my index.ctp view which is
> > displaying the links and the first content that comes up (a picture
> > and some text), then I have my vew.ctp which currently is only holding
> > the content that I want to show where the current picture and text is.
> > So I'm not entirely sure if I even have this setup correctly.
>
> > On Mar 8, 3:17 pm, "Websta*" 
> > wrote:
>
> > > Assuming your request is running - and i can see no reason why it
> > > wouldnt as long as you have the correct html elements in use then i
> > > suspect your problem lies here:
>
> > > $this->autoRender = false;
> > > exit();
>
> > > By doing this your teling your controller not to render after the
> > > action, and then your exiting so nothing at all gets output.
>
> > > So either get rid of those lines altogether or if you want to forcibly
> > > render a specific view replace it with $this->render(myView);
>
> > > hth
>
> > > Paul
>
> > > On Mar 8, 6:09 pm, "Arak Tai'Roth"  wrote:
>
> > > > I am trying to update a div via ajax, however I am using MooTools, and
> > > > not the normal Prototype and Scriptaculous.
>
> > > > Here is the code that I have in my controller:
> > > > function view($id)
> > > >                 {
> > > >                         if ($this->RequestHandler->isAjax())
> > > >                         {
> > > >                                 $dbabout = $this->About->find('first', 
> > > > array(
> > > >                                         'conditions' => array(
> > > >                                                 'About.id' => $id
> > > >                                         ),
> > > >                                         'fields' => array(
> > > >                                                 'About.id', 
> > > > 'About.name', 'About.picture', 'About.description'
> > > >                                         )
> > > >                                 ));
> > > >                                 $this->set('dbabout', $dbabout);
>
> > > >                                 Configure::write('debug', 0);
> > > >                                 $this->autoRender = false;
>
> > > >                                 exit();
> > > >                         }
> > > >                         else
> > > >                         {
> > > >                                 $this->redirect('/about/');
> > > >                                 $this->exit();
> > > >                         }
> > > >                 }
>
> > > > and then my ajax:
> > > > window.addEvent('domready', function()
> > > > {
> > > >         var req = new Request.HTML(
> > > >         {
> > > >                 url: $('ajax_replace').get('href'),
>
> > > >                 onSuccess: function(html){
> > > >                         $('about_descriptioncontent').adopt(html);
> > > >                 }
> > > >         });
>
> > > >         $('ajax_replace').addEvent('click', function(
> > > >         {
> > > >                 req.

Re: MooTools Ajax with Cake

2009-03-09 Thread r4zv4n

Hi,

The fact that the page is loading instead of the Ajax request being
sent should signal that there's an error in your JS (if it were a Cake
err, you would have had weird responses).

Upon closer inspection, here is the problem:

$('ajax_replace').addEvent('click', function(
{
req.send();
});

..should actually be:

$('ajax_replace').addEvent('click', function()
{
req.send();
});

(you simply missed a closing parenthesis)

Tip: use Firefox with FireBug  - you would have seen the error
sooner ;)

On Mar 9, 12:36 am, "Arak Tai'Roth"  wrote:
> I tried that, and removed my autoRender and exit() lines and added in
> $this->render(index); It didn't work.
>
> The page is still loading, which it shouldn't be with an AJAX request
> as far as I know.
>
> In addition I added a $this->Session->setFlash('message'); inside the
> isAjax() if statement and it doesn't pop up.
>
> I should also say that I have multiples of these links
> ('ajax_replace'), not just one, if that makes a difference.
>
> As well, I have two views right now, I have my index.ctp view which is
> displaying the links and the first content that comes up (a picture
> and some text), then I have my vew.ctp which currently is only holding
> the content that I want to show where the current picture and text is.
> So I'm not entirely sure if I even have this setup correctly.
>
> On Mar 8, 3:17 pm, "Websta*" 
> wrote:
>
> > Assuming your request is running - and i can see no reason why it
> > wouldnt as long as you have the correct html elements in use then i
> > suspect your problem lies here:
>
> > $this->autoRender = false;
> > exit();
>
> > By doing this your teling your controller not to render after the
> > action, and then your exiting so nothing at all gets output.
>
> > So either get rid of those lines altogether or if you want to forcibly
> > render a specific view replace it with $this->render(myView);
>
> > hth
>
> > Paul
>
> > On Mar 8, 6:09 pm, "Arak Tai'Roth"  wrote:
>
> > > I am trying to update a div via ajax, however I am using MooTools, and
> > > not the normal Prototype and Scriptaculous.
>
> > > Here is the code that I have in my controller:
> > > function view($id)
> > >                 {
> > >                         if ($this->RequestHandler->isAjax())
> > >                         {
> > >                                 $dbabout = $this->About->find('first', 
> > > array(
> > >                                         'conditions' => array(
> > >                                                 'About.id' => $id
> > >                                         ),
> > >                                         'fields' => array(
> > >                                                 'About.id', 'About.name', 
> > > 'About.picture', 'About.description'
> > >                                         )
> > >                                 ));
> > >                                 $this->set('dbabout', $dbabout);
>
> > >                                 Configure::write('debug', 0);
> > >                                 $this->autoRender = false;
>
> > >                                 exit();
> > >                         }
> > >                         else
> > >                         {
> > >                                 $this->redirect('/about/');
> > >                                 $this->exit();
> > >                         }
> > >                 }
>
> > > and then my ajax:
> > > window.addEvent('domready', function()
> > > {
> > >         var req = new Request.HTML(
> > >         {
> > >                 url: $('ajax_replace').get('href'),
>
> > >                 onSuccess: function(html){
> > >                         $('about_descriptioncontent').adopt(html);
> > >                 }
> > >         });
>
> > >         $('ajax_replace').addEvent('click', function(
> > >         {
> > >                 req.send();
> > >         });
>
> > > });
>
> > > The problem is nothing is happening, plus when I click one of the
> > > links it looks like the page itself is re-loading, which shouldn't be
> > > happening if it's Ajax. I have the view controller sending data to
> > > view.ctp, which I was hoping would be adopted in the div I want to
> > > update as per the ajax above.
>
> > > If anyone can help me out with this that would be awesome, thanks in
> > > advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: MooTools Ajax with Cake

2009-03-08 Thread Arak Tai'Roth

I tried that, and removed my autoRender and exit() lines and added in
$this->render(index); It didn't work.

The page is still loading, which it shouldn't be with an AJAX request
as far as I know.

In addition I added a $this->Session->setFlash('message'); inside the
isAjax() if statement and it doesn't pop up.

I should also say that I have multiples of these links
('ajax_replace'), not just one, if that makes a difference.

As well, I have two views right now, I have my index.ctp view which is
displaying the links and the first content that comes up (a picture
and some text), then I have my vew.ctp which currently is only holding
the content that I want to show where the current picture and text is.
So I'm not entirely sure if I even have this setup correctly.

On Mar 8, 3:17 pm, "Websta*" 
wrote:
> Assuming your request is running - and i can see no reason why it
> wouldnt as long as you have the correct html elements in use then i
> suspect your problem lies here:
>
> $this->autoRender = false;
> exit();
>
> By doing this your teling your controller not to render after the
> action, and then your exiting so nothing at all gets output.
>
> So either get rid of those lines altogether or if you want to forcibly
> render a specific view replace it with $this->render(myView);
>
> hth
>
> Paul
>
> On Mar 8, 6:09 pm, "Arak Tai'Roth"  wrote:
>
> > I am trying to update a div via ajax, however I am using MooTools, and
> > not the normal Prototype and Scriptaculous.
>
> > Here is the code that I have in my controller:
> > function view($id)
> >                 {
> >                         if ($this->RequestHandler->isAjax())
> >                         {
> >                                 $dbabout = $this->About->find('first', 
> > array(
> >                                         'conditions' => array(
> >                                                 'About.id' => $id
> >                                         ),
> >                                         'fields' => array(
> >                                                 'About.id', 'About.name', 
> > 'About.picture', 'About.description'
> >                                         )
> >                                 ));
> >                                 $this->set('dbabout', $dbabout);
>
> >                                 Configure::write('debug', 0);
> >                                 $this->autoRender = false;
>
> >                                 exit();
> >                         }
> >                         else
> >                         {
> >                                 $this->redirect('/about/');
> >                                 $this->exit();
> >                         }
> >                 }
>
> > and then my ajax:
> > window.addEvent('domready', function()
> > {
> >         var req = new Request.HTML(
> >         {
> >                 url: $('ajax_replace').get('href'),
>
> >                 onSuccess: function(html){
> >                         $('about_descriptioncontent').adopt(html);
> >                 }
> >         });
>
> >         $('ajax_replace').addEvent('click', function(
> >         {
> >                 req.send();
> >         });
>
> > });
>
> > The problem is nothing is happening, plus when I click one of the
> > links it looks like the page itself is re-loading, which shouldn't be
> > happening if it's Ajax. I have the view controller sending data to
> > view.ctp, which I was hoping would be adopted in the div I want to
> > update as per the ajax above.
>
> > If anyone can help me out with this that would be awesome, thanks in
> > advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: MooTools Ajax with Cake

2009-03-08 Thread Websta*

Assuming your request is running - and i can see no reason why it
wouldnt as long as you have the correct html elements in use then i
suspect your problem lies here:

$this->autoRender = false;
exit();

By doing this your teling your controller not to render after the
action, and then your exiting so nothing at all gets output.

So either get rid of those lines altogether or if you want to forcibly
render a specific view replace it with $this->render(myView);

hth

Paul



On Mar 8, 6:09 pm, "Arak Tai'Roth"  wrote:
> I am trying to update a div via ajax, however I am using MooTools, and
> not the normal Prototype and Scriptaculous.
>
> Here is the code that I have in my controller:
> function view($id)
>                 {
>                         if ($this->RequestHandler->isAjax())
>                         {
>                                 $dbabout = $this->About->find('first', array(
>                                         'conditions' => array(
>                                                 'About.id' => $id
>                                         ),
>                                         'fields' => array(
>                                                 'About.id', 'About.name', 
> 'About.picture', 'About.description'
>                                         )
>                                 ));
>                                 $this->set('dbabout', $dbabout);
>
>                                 Configure::write('debug', 0);
>                                 $this->autoRender = false;
>
>                                 exit();
>                         }
>                         else
>                         {
>                                 $this->redirect('/about/');
>                                 $this->exit();
>                         }
>                 }
>
> and then my ajax:
> window.addEvent('domready', function()
> {
>         var req = new Request.HTML(
>         {
>                 url: $('ajax_replace').get('href'),
>
>                 onSuccess: function(html){
>                         $('about_descriptioncontent').adopt(html);
>                 }
>         });
>
>         $('ajax_replace').addEvent('click', function(
>         {
>                 req.send();
>         });
>
> });
>
> The problem is nothing is happening, plus when I click one of the
> links it looks like the page itself is re-loading, which shouldn't be
> happening if it's Ajax. I have the view controller sending data to
> view.ctp, which I was hoping would be adopted in the div I want to
> update as per the ajax above.
>
> If anyone can help me out with this that would be awesome, thanks in
> advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: MooTools Ajax with Cake

2009-03-08 Thread Arak Tai'Roth

Anyone able to help me with this issue?

I've tried googling anything where MooTools is used with CakePHP, but
there is almost nothing that I can find, and nothing with Ajax.

On Mar 7, 11:09 pm, "Arak Tai'Roth"  wrote:
> I am trying to update a div via ajax, however I am using MooTools, and
> not the normal Prototype and Scriptaculous.
>
> Here is the code that I have in my controller:
> function view($id)
>                 {
>                         if ($this->RequestHandler->isAjax())
>                         {
>                                 $dbabout = $this->About->find('first', array(
>                                         'conditions' => array(
>                                                 'About.id' => $id
>                                         ),
>                                         'fields' => array(
>                                                 'About.id', 'About.name', 
> 'About.picture', 'About.description'
>                                         )
>                                 ));
>                                 $this->set('dbabout', $dbabout);
>
>                                 Configure::write('debug', 0);
>                                 $this->autoRender = false;
>
>                                 exit();
>                         }
>                         else
>                         {
>                                 $this->redirect('/about/');
>                                 $this->exit();
>                         }
>                 }
>
> and then my ajax:
> window.addEvent('domready', function()
> {
>         var req = new Request.HTML(
>         {
>                 url: $('ajax_replace').get('href'),
>
>                 onSuccess: function(html){
>                         $('about_descriptioncontent').adopt(html);
>                 }
>         });
>
>         $('ajax_replace').addEvent('click', function(
>         {
>                 req.send();
>         });
>
> });
>
> The problem is nothing is happening, plus when I click one of the
> links it looks like the page itself is re-loading, which shouldn't be
> happening if it's Ajax. I have the view controller sending data to
> view.ctp, which I was hoping would be adopted in the div I want to
> update as per the ajax above.
>
> If anyone can help me out with this that would be awesome, thanks in
> advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



MooTools Ajax with Cake

2009-03-07 Thread Arak Tai'Roth

I am trying to update a div via ajax, however I am using MooTools, and
not the normal Prototype and Scriptaculous.

Here is the code that I have in my controller:
function view($id)
{
if ($this->RequestHandler->isAjax())
{
$dbabout = $this->About->find('first', array(
'conditions' => array(
'About.id' => $id
),
'fields' => array(
'About.id', 'About.name', 
'About.picture', 'About.description'
)
));
$this->set('dbabout', $dbabout);

Configure::write('debug', 0);
$this->autoRender = false;

exit();
}
else
{
$this->redirect('/about/');
$this->exit();
}
}

and then my ajax:
window.addEvent('domready', function()
{
var req = new Request.HTML(
{
url: $('ajax_replace').get('href'),

onSuccess: function(html){
$('about_descriptioncontent').adopt(html);
}
});

$('ajax_replace').addEvent('click', function(
{
req.send();
});
});

The problem is nothing is happening, plus when I click one of the
links it looks like the page itself is re-loading, which shouldn't be
happening if it's Ajax. I have the view controller sending data to
view.ctp, which I was hoping would be adopted in the div I want to
update as per the ajax above.

If anyone can help me out with this that would be awesome, thanks in
advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---