cve60069 Posted July 19, 2013 Share Posted July 19, 2013 hello I am wanting to pass a number of variables to a modal using a cloned line. I write the variables into a string and then write to the modal using jquery. I attach a program showing my wants. if you refer to lines 65 and 66, I accessed two variables using 'name' and 'alt'. I created these variables on line 104. However, I want to pass more than just two variables and I would like to address the variables by their object.descriptor such as 'description, amount or duration'.. Is there a method to add these descriptors to the input statement, please? input.prototype.duration maybe. variables.html Link to comment Share on other sites More sharing options...
justsomeguy Posted July 19, 2013 Share Posted July 19, 2013 I would put all variables into an object as properties, JSON-encode the object to a string, and store the object in an attribute like rel. In the handler function you can get the attribute and convert the JSON string back into an object. Link to comment Share on other sites More sharing options...
cve60069 Posted July 20, 2013 Author Share Posted July 20, 2013 Thanks for the advise. I attach the program with JSON added. If you see the alert, the JSON variable 'x' converts to the object so did not work. Did I do the method correct. variables.html Link to comment Share on other sites More sharing options...
cve60069 Posted July 20, 2013 Author Share Posted July 20, 2013 Hi I created two functions to read the variables from a string (lines 60 and 70) and then converted into my variables on lines 82 and 83. Works for me. Thanks for the JSON tip variables.htmlvariables.html Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now