No, redirect() does not append a "#". Rather, it simply returns a 303 
response to the browser along with whatever URL you provide.

I assume what is happening is that you are submitting a form from the 
browser. By default, the action attribute in a web2py form is "#", which 
sends the request to the current URL but with a "#" appended (note, the "#" 
doesn't get sent to the server, so the server doesn't know about it). Your 
form processing action probably redirects to another URL. When the browser 
processes that redirect, it will retain the "#" on the redirect URL.

If you want to remove the "#", set your form action to "" (technically 
incorrect, but should work -- web2py used to do that but changed to "#" 
because an empty action is technically invalid).

Anthony

On Monday, February 3, 2014 10:25:55 AM UTC-5, horridohobbyist wrote:
>
> Sorry, you are incorrect. redirect() always appends '#'. There's nothing 
> I'm doing on the client side that would account for this. Here are all the 
> redirect() calls in my code, and they all append the fragment identifier:
>
> redirect(URL('add_to_cart')
>
> redirect(URL('show_reviews')
>
> redirect(URL('index')
>
> redirect(session.back_to_view)
>
> This last one is obtained from:
>
> session.back_to_view = request.env.http_referer
>
>
> On Monday, 3 February 2014 10:03:35 UTC-5, Marin Pranjić wrote:
>>
>> We can only guess without seeing the code.
>>
>> My guess is:
>>
>> 1. redirect doesn't append #, something else does it client side
>> 2. # doesn't break script execution, something else does (probably same 
>> issue that appends #)
>>
>> Can you check your console for javascript error logs?
>>
>> Marin
>>
>>
>> On Mon, Feb 3, 2014 at 3:59 PM, horridohobbyist <horrido...@gmail.com>wrote:
>>
>>> I have the following added to the end of a view:
>>>
>>> <script>
>>>     $(function(){
>>>         
>>> $("#includedContent").load("/MyApp/static/desc/P"+id+"_desc.html"); 
>>>     });
>>> </script>
>>> <div id='includedContent'></div>
>>>
>>> This works fine. However, if this page is arrived from a redirect(), the 
>>> URL has a fragment identifier '#' appended. For some reason, this causes 
>>> the script *not* to execute and so I don't get the included content.
>>>
>>> Two questions:
>>>
>>>    1. Why is the fragment identifier blocking the script?
>>>    2. Why is it necessary for redirect() to always append a fragment 
>>>    identifier? If the fragment identifier is sometimes needed, why can't it 
>>> be 
>>>    optional? 
>>>
>>>
>>> Thanks.
>>>
>>> -- 
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> --- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to web2py+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to