In order for an associated view to be executed, you must return a 
dictionary. If you return a string or HTML helper, it will be returned 
directly to the browser with no view being executed.

Anthony

On Wednesday, January 2, 2019 at 3:14:50 PM UTC-5, Vlad wrote:
>
> I am sure I am missing something very basic here, but... googling didn't 
> help...
>
> When I have a contoller which I use in ajax calls, it all works just 
> perfect except that the view loses the formatting (for example, it does 
> keep the links and bullets - yet loses bootstrap formatting of everything). 
> I don't understand why this happens and how to fix it. After all the view 
> extends layout.html which does include everything, so why would it make a 
> difference if html code is direct on the page or embedded via ajax? 
>
> For example: the following 2 controllers via ajax produce exactly same 
> non-formatted html:
>
> def test1():
>     return XML("<ul class='nav nav-tabs'><li class='active'><a 
> href='#'>Home</a></li><li>\
>                #<a href='#'>M1</a></li><li><a href='#'>M2</a></li><li><a 
> href='#'>M3</a></li></ul>")
>     
> def test2():
>     return XML("<ul><li><a href='#'>Home</a></li><li>\
>                <a href='#'>M1</a></li><li><a href='#'>M2</a></li><li><a 
> href='#'>M3</a></li></ul>")
>
> In fact, even without ajax, when I allow these controllers to go through 
> default views (i.e. without having a dedicated view) - this is exactly what 
> happens too, but here I sort of understand it - while in a case of ajax I 
> don't, because ajax is embedded into real view html and should really 
> pickup all the appropriate formatting which works well on the rest the 
> page. 
>
> What am I missing? How do I fix this?
>
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to