User Profile

Collapse

Profile Sidebar

Collapse
jerrysc
jerrysc
Last Activity: Jul 1 '14, 01:43 AM
Joined: May 16 '14
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • I figured this out! Anyone who is curious, I placed the javascript variable in a different script, which resides within the loop where the php results are displayed.

    Code:
    <script>
    var title = <?php echo json_encode($book_title); ?>;
    </script>
    I have also edited my answer above to show specifically where I placed this.
    See more | Go to post

    Leave a comment:


  • jerrysc
    started a topic Need help passing variable from php to javascript
    in PHP

    Need help passing variable from php to javascript

    I have a problem I've been trying to work through, to which I think there is a probably a simple solution I am missing. I am trying to pass a variable from php to javascript. Seems like it should be easy. The php variable will echo all I want it to; it will echo to the php file where the code is written, and it will echo into the jquery window where my results are listed (from a google books search). But the value of the variable will not propagate...
    See more | Go to post
    Last edited by jerrysc; May 16 '14, 04:46 PM. Reason: Showing how to solve the issue I had - figured it out...
No activity results to display
Show More
Working...