You need an ajax view for the action that either prints out just the
snippet of html ( HIJAX or AJAH method ) and renders that by itself
without a layout.
Or..
You can return a javascript array in your view. ( JSON method )
Or..
You can return a well formed XML document ( AJAX method ) with an xml
layout that sets the content type headers correctly for you.
With the first one the $( "selector" ).html( returnedHtml ) will put
the markup into the the element selector ( usually a container div )
With the second two you need to parse and transform the JSON or XML
into html using jquery ( or even better, any one of the jquery dom
creation tools on the jquery plugins page ) and insert the content
into the document. Usually this would happen in one of jquery's ajax
method callbacks. There are a few good tutorials on the jquery
tutorial page.
If the appended elements need to have even handler applied to them you
can do so in the callbacks as well. There is an excellent tutorial
linked from the jquery site named something along the lines of
"Correctly using callbacks" or some such listed under the Ajax heading
that explains this very well.
Good luck.
On Jul 3, 7:26 am, Jim Newfer <[EMAIL PROTECTED]> wrote:
> Gremlin, thank you so much for your reply! So far it isn't working but
> in the top of my javascript I have arequestAction, and in my
> controller I set something like this
>
> if(isset($this->params['requested'])) {
> return array('stories' => $getstories, 'school' =>
> $schoolname);
>
> That is all I should need to do to have jquery be able to access my
> models right ?
>
> Thanks for any more advice from anyone.
>
> On Jul 2, 10:24 pm, gremlin <[EMAIL PROTECTED]> wrote:
>
> > You can call a script the same way, just use $( "#quote p" ).load( "/
> > contoller/action" );
>
> > Make sure your controller handlesajaxrequests. If you don't know
> > what that means look uprequestActionor parseExtensions in the
> > groups.
>
> > On Jul 2, 10:12 pm, Jim Newfer <[EMAIL PROTECTED]> wrote:
>
> > > I have been usingjquery, which is great btw, with cakephp for a
> > > couple of weeks now. I love it to say the least. I haven't really
> > > dealt withajaxvery much, but I have done some basic things with it,
> > > and PHP outside of cake. Needless to say, when it comes time to use
> > >jquery'sajaxfunctionality with cake, I am completely and totally
> > > lost.
>
> > > I trying to get this EXTREMELY simple tutorial to work with cakephp
> > > for about the past 3 hours, and just cannot seem to figure it out.
>
> > >http://www.sitepoint.com/article/ajax-jquery
>
> > > I think it make have something to do with this line injquery, where
> > > it calls for an outside script.
>
> > > $("#quote p").load("script.php");
>
> > > I was wondering is there some way to instead, call upon a specific
> > > controller? Or passjqueryinformation?
>
> > > Obviously I do not want to include a separate script because that
> > > would be an unnecessary hassle. I am just looking for pointers/tips on
> > > how to useajax'sfunctionality with cake, because I cannot seem to
> > > find any good tutorials anywhere on incorporatingjqueryinto cake.
>
> > > Any guidance is GREATLY appreciated.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---