javascript variables and mivascript variables

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jeffwo
    Mivite Lite

    • Jun 2012
    • 5

    #1

    javascript variables and mivascript variables

    Hello,

    If I create a variable and assign it a number can I reference that variable in miva script if all the code is on the same page?

    Thanks ahead of time,

    Jeff
  • Bruce - PhosphorMedia
    Developer Partner











    • Mar 2006
    • 11256

    #2
    Re: javascript variables and mivascript variables

    If you mean a JS variable, no because JS runs in the users browser on their PC. Miva runs on the web server. If you need to pass a JS variable to Mivascript (when a page is next executed) you can simply write the JS variable it a hidden input form...but that only works with a <form> element.
    Bruce Golub
    Phosphor Media - "Your Success is our Business"

    Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
    phosphormedia.com

    Comment

    • Emma
      Mivite

      • Mar 2006
      • 230

      #3
      Re: javascript variables and mivascript variables

      Yeah, next page, or just a simple $ajax post with your variable (almost the same thing). Anyhow, you need a second page in mivascript in order to catch and process the variable.

      I do this all the time and here is the idea:

      1. MS page 1 : I create a sessionid var that I'll transfer to the JS script (ex: <mveval expr="{'<script>var session="'$l.mysessionid$'";</script>'}">
      2. In JS I use this var + my other vars to POST data to MS page 2

      This way I catch the var and I keep track of the sessionid ...

      Don't know if I was clear :)
      Zen Radio : Relax :) : www.zenradio.fm
      MivaScript Tutorials & Scripts : www.mivascript.org

      Comment

      Working...
      X