Try this,
{{response.files.append(URL(r=request,c='static',f='/js/d3.js'))}}
{{extend 'layout.html'}}


The in the web console try

d3.select('body').append('svg').append('circle').style("stroke",
"gray").style("fill", "red").attr("r", 40).attr("cx", 50).attr("cy", 50);

I´m into D3.js too!




2013/1/12 Alan Etkin <[email protected]>

> Hi, I am new to web2py and I would like to embed a running (tested with
>> flask)
>> javascript based on d3.js in a web2py view.
>>
>
> If the script can go in the body of the document, you can do this in a
> view:
>
> {{=SCRIPT(_type="text/javascript", _src=URL(c="static", f="js/<the
> script's name>"))}}
>
> Where <the script's name> is stored in the scaffolding app's static/js
> folder
>
> If not, then you can add it to the head by appending the URL(...) to the
> response.files global object in the model
>
> response.files.append(URL(...))
>
>  --
>
>
>
>

-- 



Reply via email to