简体   繁体   中英

How To Use Variable In Javascript Code Ex: src=“htp://www.url.com/file.php?id=[3434]”

I'm running a wordpress multisite network where I give users an options page with different settings to make their page unique.

I would like to implement a GetResponse optin form on their page.

In the options page I have a field where they can put in their GetResponse FormID - which is usually 6 numbers (422125).

The getresponse form looks like this:

<script type="text/javascript" src="http://app.getresponse.com/view_webform.js?wid=422125&mg_param1=1"></script>

I need to be able to change 422125 to whatever id they set within their options page.

I already have the php code written that calls the id from the options page, but I can't figure out how to set it within the javascript.

Any help would be greatly appreciated... Thank you for your time!

在PHP页面上,您可以执行以下操作,它将回显$form_id作为URL的wid参数。

<script type="text/javascript" src="http://app.getresponse.com/view_webform.js?wid=<?php echo $form_id ?>&mg_param1=1"></script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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