I can't speak for Derek, but here's how I handle this stuff.

<span id="to_be_updated">foo</span> 

<script>
$('#to_be_updated).on('click', function(event){
  ajax('update_span', [ ], ':eval')
...
</script>

in the controller:
def update_span():
  return "$('#to_be_updated').html('fubar');"



On Wednesday, November 6, 2013 3:25:11 PM UTC-5, step wrote:
>
>
>
> On Wednesday, November 6, 2013 7:55:23 PM UTC+1, Derek wrote:
>>
>> You'll most likely need to use ajax() from web2py.js and use 'eval' and 
>> return the javascript to run.
>>
>>>  
> Well if I change op() in controllers/archive.py to return a script like 
> this:
>  
> def op():
>     status = ''
>     if request.args:
>         status = SPAN('')
>         op = request.args(-1)
>         error, message = op_archive(op=op)
>         if error:
>             status['_class'] = 'icon icon-thumbs-down'
>         else:
>             status['_class'] = 'icon icon-thumbs-up' 
>         *status.append(SCRIPT(r
> "$('#archive_op_fix_result').text(XML(message))", _type='javascript'))*
>      return dict(status=status)
>
>
> I can get the script into the DOM, and running the script would update the 
> DIV content. What I can't figure out yet is how to actually trigger running 
> the script after web2py's component code has finished loading it....
>
> Is  this what you had in mind?
>

-- 
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/groups/opt_out.

Reply via email to