Reputation:
I'm planning on server's cherrypy with programming of python and mako. Now i have one problem because i know to pass value of Mako template to Javascript with
<script type="text/javascript">
var contapara=${input_nparams};
</script>
and viceversa? It 's possible apply viceversa Mako<---JAvascript?
Thanks
Edit:
Because I have one variable of Mako (kwargs) that contains the data of all forms sent. The user enters a word that is the "clave" and is stored in Javascript. After this I pass in Mako to search in variable (kwargs). Call the function's MAko. After exist this I open one windows with the textarea (new form) and I have to write data. AFter the user change data and send the form.
Upvotes: 2
Views: 3534
Reputation: 16212
Make a view that takes in the arguments that you would want to send to mako, then in your javascript use ajax. for example:
jQuery.ajax(
{
url : url_of_the_mako_view,
data : {foo:bar,foo2:bar2},
type : 'POST',
success : function(data)
{
/*
when the mako template is rendered by your view then the result will
be passed to this function in the variable data
*/
}
}
)
If you are after something a little more like a page redirect then you can do something more like this:
Upvotes: 1