简体   繁体   English

如何将Javascript变量数据传递给Template Toolkit?

[英]How can I pass Javascript variable data to Template Toolkit?

I am writing a form that takes zip code input. 我正在写一个需要邮政编码输入的表格。 Javascript code determines city & state based on zip code. Javascript代码根据邮政编码确定城市和州。 I would like the city and state to appear on a 'results' page that is displayed when the user completes the form. 我希望城市和州显示在用户填写表单时显示的“结果”页面上。 I can only get Template Toolkit to display the form input params on the result page. 我只能获得Template Toolkit才能在结果页面上显示表单输入参数。 Is there a way to get the city and state to appear? 有没有办法让城市和州出现?

As @isherwood notes, without more detail it's hard to say. 正如@isherwood所指出的,没有更多细节很难说。

But I would suspect you might want to have whatever does your Javascript city/state decoding push their results into some hidden or uneditable form fields, so they make the round-trip to your server and are available for the next round of TT rendering. 但是我怀疑您可能想对Javascript城市/州进行解码,然后将其结果推送到某些隐藏或不可编辑的表单字段中,以便它们往返于您的服务器,并且可用于下一轮TT渲染。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM