Hi Jason,
Thanks for reply.
But I don't want pass controller variable into view javascript.
I have python variable defined in view itself and now want to pass this
variable to javascript.
here is code:
{{x = [86, 2, 31, 153, 192, 245, 435, 459]}}
Now I want to call this x variable in javascript function
glmol01.defineRepresentation
<script type="text/javascript">
var glmol01 = new GLmol('glmol01', true);
glmol01.defineRepresentation = function() {
var all = this.getAllAtoms();
};
function glmol(pdbid){
uri = "http://www.pdb.org/pdb/files/" + pdbid + ".pdb";
$.get(uri, function(ret) {
$("#glmol01_src").val(ret);
glmol01.loadMolecule();
});
</script>
Need suggestioin to solve this issue.
Thanks
On Wednesday, 4 September 2013 23:39:25 UTC-7, encompass wrote:
>
> If your meaning pass the data to the view you can do it like this:
> def index():
> var1= 12345
> return dict(var1 = var1)
>
> and then in the view in your javascript:
> var thingy_var = {{=var1}};
>
> But it gets different based on what you want to do. For example you could
> create a JSON object or need to create an array of items. Each could have
> it's own way of dealing with things.
> BR,
> Jason Brower
>
>
> On Thu, Sep 5, 2013 at 9:16 AM, sonu kumar
> <[email protected]<javascript:>
> > wrote:
>
>> Hi,
>> How to pass view python variable into java script function?
>>
>> Thanks
>>
>> --
>>
>> ---
>> 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] <javascript:>.
>> 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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.