I have this JS/Jquery code that I'm attempting to modify:
new MyFormView({
        title: "Original"
        , collection: new MyFormSnippetsCollection([
          { "title" : "Form Name"
            , "fields": {
              "name" : {
                "label"   : "Form Name"
                , "type"  : "input"
                , "value" : "Form Name"
              }
            }
          }
        ])
      })
I want the JSON data to be inserted from a variable (rather than hard coded like above), so how do I insert the variable into the value of "MyFormSnippetsCollection"?
For example, I have the pre-formatted JSON in a string:
var jsondata = '{ "title" : "Form Name"
            , "fields": {
              "name" : {
                "label"   : "Form Name"
                , "type"  : "input"
                , "value" : "Form Name"
              }
            }
          }'
I'm looking for something like this (which didn't work):
new MyFormView({
        title: "Original"
        , collection: new MyFormSnippetsCollection([
          jsondata
        ])
      })
Or is not going to be that simple? Any suggestions appreciated.
 
     
    