Need help with tempalte7 - json - template


#1

in my list view (second view) via href from index, i go this:

....
                    // Select Template
                    var templateJobs = $$('#random-template-jobs').html();
                    // Compile and render
                    var compiledTemplateJobs = Template7.compile(templateJobs);

    // Defined as function "getrandom"
    function getrandom() {
        console.log('getrandom');
          // Get JSON Data from UrbanDictionary API 
          $$.getJSON('http://api.urbandictionary.com/v0/random', function (json) {
            console.log(json);
            // Insert rendered template
            $$('#content-wrap2').html(compiledTemplate2(json))
          });
    };

it used to work, but then when i swtiched over to: template7Pages: true,
precompileTemplates: true,

it does not fill / display the template anymore…

any ideas?


#2

What exactly doesn’t work? I see you have defined compiledTemplateJobs but you are calling compiledTemplate2() in getrandom function