Monday, 5 February 2018

jquery - Executing PHP code inside a .js file

I'm trying to get a bit of PHP to execute inside of a .js file, but obviously don't know how to do it properly.




Basically the code is adding some HTML tags to my page, which I am using for a slideout contact form. However the contact form itself is done in Wordpress by a shortcode. So I'm trying to get the shortcode to work inside the code that makes the form slide out.



var phpTest = '';

// add feedback box
$this.html('

'
+ thisSettings.title
+ '

'
+ phpTest

+ '
');


If I change the variable "phpTest" to a regular string with text, it shows up fine, I'm just not sure how to execute the php in this instance.

No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...