Re: [symfony-users] :-( please help. ajax problem - noob to ajax -probably simple
In addition there are other things you can do too like tell it to use a different template to the one that it will automatically look for (great for re-using a template you've created before) by doing: $this->setTemplate('templatefilename'); //Note no return word in fron and no Success.php at the end of the template name You can also instruct an action to load a partial instead for those AJAX responses where you need content rendered: return $this->renderPartial('partialname', array('variable1'=>$variable1)); On Mon, Apr 19, 2010 at 2:43 PM, Tofuwarrior wrote: > Hi, > > If anyone can help me I would be very grateful, I'm over my head but I > think it is probably a simple thing i'm missing. I've got this far > using the jobeet tutorial and various jQuery and symfony resources but > I'm stuck. > > I'm trying to get an ajax jQuery treeMenu to work in symfony and I > think I might be lacking basic understanding about how to set it up in > Symfony. I'm using 1.4 and have installed the jQueryReloaded plugin so > no problems there. > > Currently I am doing this in the show template which is where the tree > should show. > jqueryFileTree') ; > echo jq_javascript_tag(" > $(document).ready( function() { > > $('#fileTreeDemo_1').css('background-color','#999'); > $('#fileTreeDemo_1').fileTree({ root: '/', > script: '/folder/tree/ > id/".$CmsFolder->getId()."' }, function(file) { > alert(file); > }); > > }); > > "); > ?> > > This calls the jquery file tree thing fine. By interrupting the > process in the script I can see that the div gets updated with the > loading image so that's not the problem but looking in firebug I can > see that there is a 404 happening, it says: POST > http://www.domain.com/folder/tree/id/1 > . If I access this action (which is the one supposed to return the > stuff for the ajax) I get a 500 error, no template found > (treeSuccess.php). > > I don't want a template, I just want to get the raw output of this > action into this javascript function and I figure this is the > problem. > > Just for reference. > The tree menu script is here: http://pastebin.com/R1yW0C9t > > Thanks for taking a look, I'm tearing my hair out! > > > > -- > If you want to report a vulnerability issue on symfony, please send it to > security at symfony-project.com > > You received this message because you are subscribed to the Google > Groups "symfony users" group. > To post to this group, send email to symfony-users@googlegroups.com > To unsubscribe from this group, send email to > symfony-users+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/symfony-users?hl=en > -- Gareth McCumskey http://garethmccumskey.blogspot.com twitter: @garethmcc -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en
Re: [symfony-users] :-( please help. ajax problem - noob to ajax -probably simple
All symfony actions will attempt to return the output of a template based on teh action name unless otherwise told. So if an action has the name tree (executeTree) it will attempt to render the template treeSuccess.php by default. If, however, you want to return your own content and not the default template you can override this functionality by using: return $this->renderText('Text content here even JSON'); On Mon, Apr 19, 2010 at 2:43 PM, Tofuwarrior wrote: > Hi, > > If anyone can help me I would be very grateful, I'm over my head but I > think it is probably a simple thing i'm missing. I've got this far > using the jobeet tutorial and various jQuery and symfony resources but > I'm stuck. > > I'm trying to get an ajax jQuery treeMenu to work in symfony and I > think I might be lacking basic understanding about how to set it up in > Symfony. I'm using 1.4 and have installed the jQueryReloaded plugin so > no problems there. > > Currently I am doing this in the show template which is where the tree > should show. > jqueryFileTree') ; > echo jq_javascript_tag(" > $(document).ready( function() { > > $('#fileTreeDemo_1').css('background-color','#999'); > $('#fileTreeDemo_1').fileTree({ root: '/', > script: '/folder/tree/ > id/".$CmsFolder->getId()."' }, function(file) { > alert(file); > }); > > }); > > "); > ?> > > This calls the jquery file tree thing fine. By interrupting the > process in the script I can see that the div gets updated with the > loading image so that's not the problem but looking in firebug I can > see that there is a 404 happening, it says: POST > http://www.domain.com/folder/tree/id/1 > . If I access this action (which is the one supposed to return the > stuff for the ajax) I get a 500 error, no template found > (treeSuccess.php). > > I don't want a template, I just want to get the raw output of this > action into this javascript function and I figure this is the > problem. > > Just for reference. > The tree menu script is here: http://pastebin.com/R1yW0C9t > > Thanks for taking a look, I'm tearing my hair out! > > > > -- > If you want to report a vulnerability issue on symfony, please send it to > security at symfony-project.com > > You received this message because you are subscribed to the Google > Groups "symfony users" group. > To post to this group, send email to symfony-users@googlegroups.com > To unsubscribe from this group, send email to > symfony-users+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/symfony-users?hl=en > -- Gareth McCumskey http://garethmccumskey.blogspot.com twitter: @garethmcc -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en