Jeff Stevens
Forum Replies Created
-
Forum: Plugins
In reply to: [URL Params] Param to iframe srcMarcus – so did you ever get your URL param’s to work in the iFrame?
I currently have
<iframe src=”https://mysite.com?id=” />But I can’t add the short code inside the double quotes. How did you get yours to work?
Thanks,
Forum: Fixing WordPress
In reply to: Using PHP variables in javascriptNot sure where to put the add_action – but other than that it’s working. I’ll mark this as resolved.
Forum: Fixing WordPress
In reply to: Using PHP variables in javascriptNo – I didn’t have my jquery loaded.
I’ve got it loaded now. Although – I’m not sure where to put the
add_action( ‘wp_enqueue_scripts’, ‘enqueue_scripts );
line? The function – I just added to the end of the functions.php file – but if I put the add_action at the end – I get an error re-loading my WordPress (makes sense) But I’m not sure where it needs to go.So – data-cookie – is that a name you just made up – or is that a standard object?
And – even with out putting in the enqueue scripts – I’m getting what I would expect on my test (woo-hoo). So, now this code….
<head></head> <body> [insert_php] $testVar = "Hello"; echo '<i data-cookie="' . $testVar . '" />'; [/insert_php] <script type="text/javascript"> document.write('In Script...'); var cookieData = jQuery('[data-cookie]'); cookieData = cookieData.attr('data-cookie'); document.write(cookieData); </script> </body>Produces this…
In Script…HelloAgain – Thanks for your help on this. It’s starting to make more sense now.
Forum: Fixing WordPress
In reply to: Using PHP variables in javascriptOk – thank you!
So, I have code like this…
<head></head> <body> [insert_php] $testVar = "Hello"; echo '<i testVar="$testVar" />'; [/insert_php] <script type="text/javascript"> document.write('In Script...'); var testVar = jQuery('[testVar]'); testVar = testVar.attr('testVar'); document.write(testVar); </script> </body>My output is
In Script…$testVarWhy isn’t my output
In Script…Hello
?Forum: Fixing WordPress
In reply to: Using PHP variables in javascriptYes – very helpful!
On the “echo ‘<i …. line – what is the i for? integer?
And I would need to make sure that I have the jQuery jar included?
Forum: Fixing WordPress
In reply to: Using PHP variables in javascriptThanks for jumping in here.
I have some php code this is getting a session ID and token. Then I need those ID’s and tokens in Javascript to call some .js code. (I’m working on getting TokBox to work from my wordpress sites).
But I’m just doing a test with the code above – as once I come out of the php code – I don’t know how to access any of the variables that I created and populated in the php code.
Forum: Fixing WordPress
In reply to: Using PHP variables in javascriptCan you share or correct my code please? I’m not sure of how the syntax should work on that.
Ah – you’re correct. Thanks so much.
I’ll check my console more often also.Thanks
Thanks for the reply – that’s kind of what I thought also – and had tried something like that before. Here is some more code and I still just get one “Hello” – and we should get two – right?
... $testVar = "Hello"; echo $testVar . "\n"; echo '<script type="text/javascript">'; echo "document.write($testVar);"; echo '</script>'; echo "PHP Code out..."; [/insert_php]