ajax calls do not execute js in views but you can return any js code
from a web2py controller as in

response.js="activate_slider();"

and it should do it.

On Sep 26, 8:46 pm, Jose <[email protected]> wrote:
> Hello,
>
> I have a beautiful slider. In my layout.html define the following to
> activate it.
>
> function active_slider(){
>     $('#slider').nivoSlider({
>                 ...
>         });
>
> }
>
> $(window).load(function() {
>     active_slider();
>
> });
>
> If the images show the slider the get from the database by calling a
> function and using its corresponding view, it works well. Implicitly
> call activate_slider().
>
> The problem I have it because I'm loading the slider through function
> ajax (...).
>
> SPAN('something', _onclick="$('#id').attr('value','%d');
> ajax('bg_myfunction', ['id'], 'target');"%r.id)
>
> I tried adding a call to activate_slider(), but does not work.
>
> SPAN('something', _onclick="$('#id').attr('value','%d');
> ajax('bg_myfunction', ['id'], 'target'); activate_slider();"%r.id)
>
> to try, if I put a link manually calling activate_slider(), works
> well, and start working.
>
> {{=A('Activate Slider', _href="javascript:activate_slider();")}}
>
> How should I do?
>
> Jose

Reply via email to