Skip to content

js中如何获得html模板中{{xx}}的变量值,求大神告知 #2086

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
smalldarks opened this issue Jun 15, 2017 · 9 comments
Closed

js中如何获得html模板中{{xx}}的变量值,求大神告知 #2086

smalldarks opened this issue Jun 15, 2017 · 9 comments

Comments

@smalldarks
Copy link

<textarea name="alipay_gold_wechat" id="jKih64_8" class="jX1hdl">{{ alipay_str_wechat }}</textarea>

js中如何提前获得alipay_str_wechat 的值,试了好些方法没用。

@bdarnell
Copy link
Member

I'm sorry, but none of the Tornado maintainers can read Chinese so you'll need to use English in your issue reports.

I have a guess that you want to use {{! alipay_str_wechat }} to get a literal {{ in your template output so that javascript can use it.

@smalldarks
Copy link
Author

Thank you, I want to get the value of html template with javascript ,like this:

<textarea name="alipay_gold_wechat" id="jKih64_8" class="jX1hdl">{{ alipay_str_wechat }}</textarea>

How to get the alipay_str_wechat in javascript code.

@bdarnell
Copy link
Member

Something like this: <script>var alipay_str_wechat={{ json_encode(alipay_str_wechat) }}</script>

@13947965133
Copy link

13947965133 commented Jul 7, 2017 via email

@rfyiamcool
Copy link

rfyiamcool commented Jul 13, 2017

@smalldarks 你丫也太厉害了.... 直接用中文 强干...

@bdarnell You are too kind ,Thank U

@lyle-w
Copy link

lyle-w commented Jul 14, 2017

@bdarnell Such a kindly programmer

@leonayx123
Copy link

Such a kindly programmer.!
It feels like you're in control of another language~~

@ghost
Copy link

ghost commented May 7, 2020

请你们不要再讨论这个问题了,这不是闲聊区。
Please stop talking about this issue, this is not a chat area.

@leafcoder
Copy link

Something like this: <script>var alipay_str_wechat={{ json_encode(alipay_str_wechat) }}</script>

Perfect solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants