Announcement

Collapse
No announcement yet.

pass a javascript variable value to miva

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    pass a javascript variable value to miva

    How do I assign data to a Miva global variable when the data is generated by a javascript function after the page load. For example I have a button which calls a javascript function to capture a screenshot and save it, then it returns an alert box which contains the name of the image.

    alert(obj.something_name);

    How can I save the value of obj.something_name to a Miva variable? Which can then be used as a custom basket field.
    Gary

    [email protected]
    www.icCommerce.com

    #2
    Re: pass a javascript variable value to miva

    You have two options:

    1. If the page will always be submit (like an add to cart form) you can use JS to add your value to an hidden input. The on the page the form submits to, add the logic to save it as a custom basket field.

    2. If the page is not part of a form, then you need to do an ajax call to a miva page, passing you JS variable as a url parameter. This will allow you to read it in (as a global variable) and save it to a custom basket field
    Brennan Heyde
    VP Product
    Miva, Inc.
    [email protected]
    https://www.miva.com

    Comment

    Working...
    X