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.

Read More

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!

Related posts

Leave a Reply

1 comment

  1. on a PHP page you can do the following and it will echo $form_id as the wid parameter of the url.

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