On 03.04.2011 20:17, Christophe COEVOET wrote:
> Le 03/04/2011 20:09, oscar balladares a écrit :
>> Hi everybody
>> I'm working with Ajax.
>> I have a html list with, for example 2 rows,  and they can be removed
>> via Ajax.
>>
>> If 1 row is removed, the Controller will return the updated list.
>>
>> And if the last row is removed, the Controller will return a
>> RedirectResponse() to the homepage instead.
>>
>> The problem is that I have to handle the redirection because the
>> result of
>> $('#div_where_the_response_goes').load('route_to_the_controller');
>> will result in the inclusion of the homepage inside the <div
>> id="div_where_the_response_goes></div>, and the actual redirection
>> won't happen.
>>
>> So I came up with:
>> return new RedirectResponse($this->generateUrl('homepage'), 303);
>>
>> but, vía ajax, the returned status code will be alway 200.
>>
>> I'm trying to do:
>>
>> if (status == 200)
>>   $('div_where_the_response_goes').html(data);
>> elseif (status == 303)
>>   figure out how to redirect via javascript to the homepage. (this is
>> another issue that maybe is resolved with headers ).
>>
>>
>> I must say that I see that RedirectResponse doesnt return the
>> redirection directive but the result of the redirection (the homepage
>> in my case).
>>
>> How can I return a 303 code?
> The status code is likely to be 200 because of the profiler which is
> configured to intercept the redirection in the dev environment of the
> standard edition.

Made a pull request to address this, I hope it makes sense:

https://github.com/symfony/symfony/pull/470

Cheers

-- 
Jordi Boggiano
@seldaek :: http://seld.be/

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