If you just want to return a simple string you probably want to:

# Controllers definition {
#some logic here

return new Response("</b>There are some errors on this field</b>");

...........

You must import the namespace for Response :

use Symfony\Component\HttpFoundation\Response;


2011/4/15 symfonyMan <ezziani.cha...@gmail.com>

> Hello,
>
> thanks for all this responses.
>
> the controller must return a template ?
>
> Me, I need ajax just for validate email, and print "ok" next to the
> email field...
>
> sorry i have a bad english :)
>
> thnaks
>
> On 15 avr, 00:12, oscar balladares <liebegr...@gmail.com> wrote:
> > The controller should return a template response, a common template
> (without
> > inheritance of course)
> >
> > 2011/4/14 oscar balladares <liebegr...@gmail.com>
> >
> > > With JQuery you can request Marc's controller's route. That should do
> the
> > > trick.
> >
> > > 2011/4/14 Marc MacLeod <marbe...@gmail.com>
> >
> > >> In your controller:
> >
> > >>    public function fooAction()
> > >>    {
> > >>        // Is this an ajax request?
> > >>        if ($this->container->get('request')->isXmlHttpRequest())
> > >>        {
> > >>            // do stuff and return ajax content
> > >>        }
> >
> > >>        // return normal response
> > >>     }
> >
> > >> On Apr 13, 5:16 am, symfonyMan <ezziani.cha...@gmail.com> wrote:
> > >> > hello,
> >
> > >> > could somebody show me an example using ajax in symfony 2 ??
> >
> > >> > thanks
> >
> > >> --
> > >> 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
>
> --
> 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
>

-- 
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

Reply via email to