Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • Jeff Stevens

    (@jsrestaurantlink)

    Marcus – so did you ever get your URL param’s to work in the iFrame?

    I currently have
    <iframe src=”https://mysite.com?id=&#8221; />

    But I can’t add the short code inside the double quotes. How did you get yours to work?

    Thanks,

    Thread Starter Jeff Stevens

    (@jsrestaurantlink)

    Not sure where to put the add_action – but other than that it’s working. I’ll mark this as resolved.

    Thread Starter Jeff Stevens

    (@jsrestaurantlink)

    No – 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…Hello

    Again – Thanks for your help on this. It’s starting to make more sense now.

    Thread Starter Jeff Stevens

    (@jsrestaurantlink)

    Ok – 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…$testVar

    Why isn’t my output
    In Script…Hello
    ?

    Thread Starter Jeff Stevens

    (@jsrestaurantlink)

    Yes – 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?

    Thread Starter Jeff Stevens

    (@jsrestaurantlink)

    Thanks 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.

    Thread Starter Jeff Stevens

    (@jsrestaurantlink)

    Can you share or correct my code please? I’m not sure of how the syntax should work on that.

    Thread Starter Jeff Stevens

    (@jsrestaurantlink)

    Ah – you’re correct. Thanks so much.
    I’ll check my console more often also.

    Thanks

    Thread Starter Jeff Stevens

    (@jsrestaurantlink)

    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]
Viewing 9 replies - 1 through 9 (of 9 total)