{"id":6903,"date":"2014-05-11T07:19:27","date_gmt":"2014-05-11T07:19:27","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/05\/11\/problem-about-jsrender-collection-of-common-programming-errors\/"},"modified":"2014-05-11T07:19:27","modified_gmt":"2014-05-11T07:19:27","slug":"problem-about-jsrender-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/05\/11\/problem-about-jsrender-collection-of-common-programming-errors\/","title":{"rendered":"problem about jsrender-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/5fdc8cb3f9fffec1a5d9b8e632793e04?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nIna<br \/>\njavascript jsrender<br \/>\nI would like to use a variable from my jsrender template in order to produce a snippet of javascript, but I can&#8217;t figure out how to place a &lt;script type=&#8221;text\/javascript&#8221;&gt; within my &lt;script id=&#8221;data-item-tpl&#8221; type=&#8221;text\/x-jsrender&#8221;&gt;Hopefully the below is fairly clear. The below code produces an Uncaught SyntaxError. If I remove the tags from the embedded script, then it is simply printed onto the page as text.In the code below, I am trying to generate a div with the id &#8216;chartId&#8217;, an<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/def14e2d64e6a27d81e77af8b643ba72?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nMediator<br \/>\njavascript jsrender<br \/>\nI have {{if name &amp;&amp; secondName}} {{=name}}\/{{=secondName}} {{\/if}}but this not worked. I catch error Uncaught SyntaxError: Unexpected token &amp;&amp;That I do wrong?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/9cbdd6bbc87d39c05710989508d6763a?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nA.M.K<br \/>\njquery templates jsrender<br \/>\nI am trying to put together a template with jsRender instead of my own version that I was on, but, I keep getting this: &#8220;Uncaught JsRender Error: Syntax error Unmatched or missing tag: &#8220;{{\/for}}&#8221; in template:&#8221; followed by my entire template.Here is a truncated version of my code, any ideas as to what is going on? Or is it just the nested for loops?&lt;div class=&#8221;page&#8221; id=&#8221;{{:info.id+info.name}}&#8221;&gt;{{for sources}}&lt;header class=&#8221;feed-title&#8221;&gt;&lt;div class=&#8221;feed-title-content&#8221;&gt;&lt;span cla<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/085c7773949fd2eafb66260976725dfa?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nThe Flower Guy<br \/>\njavascript jquery jsrender<br \/>\nI have a couple of jsRender templates that are used on all pages. Instead of using the script tag method, I would prefer to precompile them and put resulting functions in an external js file.I saw a previous question that asked this but the method described doesn&#8217;t seem to work anymore or I am doing something wrong.I called $.templates(&#8220;#myTemplate&#8221;) from the console which msanjay suggested and copied\/renamed the anonymous function and get something like this (which looks a bit odd to my untrain<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/0577a89e479b21d7ef4d7284db5b39bd?s=32&amp;d=identicon&amp;r=PG&amp;f=1\" \/><br \/>\nmekkoo<br \/>\njsrender jsviews<br \/>\nSample JSON: https:\/\/gist.github.com\/mekkoo\/6604902I want using $.observable().insert method to object inner array &#8220;items&#8221;. but, I looked error &#8220;Uncaught TypeError: Object # has no method &#8216;insert'&#8221; when method callingpages = \/\/Sample JSON $.ajax calling $.observable(pages).insert(pages.length, {\/\/I want this data to insert to &#8220;items&#8221; array&#8221;item&#8221;: {&#8220;id&#8221;: 3,&#8221;item_name&#8221;: &#8220;Item Name 3&#8243;,&#8221;item_desc&#8221;: &#8220;Item Desc 3&#8243;,&#8221;item_img&#8221;: &#8220;http:\/\/example.com\/sample.png&#8221;},&#8221;values&#8221;: [{&#8220;id&#8221;: 0,&#8221;key_id&#8221;: 0,&#8221;value&#8221;: &#8220;<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/45a89af8025e620812e3b8bd840d6d46?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nArun P Johny<br \/>\njavascript jquery jsrender<br \/>\nI have template this a part:&lt;td&gt;{{=name}}&lt;\/td&gt;]I need check name of null\/empty and not display it.How do this?example:{{#if ($name!= &#8220;&#8221; &amp;&amp; $secondName!= &#8220;&#8221;) }}I get error Uncaught SyntaxError: Unexpected token &amp;&amp;<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/5872fc2acaad3973056a594a71d33184?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nmattmattmatt<br \/>\njavascript jquery google-chrome jsrender<br \/>\nIm getting an Uncaught RangeError: Maximum call stack size exceeded when ever I get to the 4th time calling my paging function getCollection(), I&#8217;m not exactly sure why the problem is happening.. if I commet out the following line:jQuery(&#8216;#card ul&#8217;).append(template.render(data));And uncomment the alert below it (for sanity), it seems to run fine past page 4.I&#8217;m using jQuery 1.7.1 and Boris Moore&#8217;s jsrender library and have never had trouble before rendering even larger data sets asynchronously.v<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/f148b2fabe4f88c40459f8d587b1ce5f?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\npixeline<br \/>\njavascript jquery jsrender<br \/>\nI need to keep a &#8220;colcounter&#8221; variable inside the loop that will be used to fill a jsrender template.Here is my template code&lt;script id=&#8221;datascapeTemplate&#8221; type=&#8221;text\/x-jsrender&#8221;&gt;&lt;div id=&#8221;dsViewport&#8221;&gt;&lt;div class=&#8221;ds-column&#8221; style=&#8221;width:{{:(name.length*100)}}px;&#8221;&gt;&lt;h1 id=&#8221;datascapeName&#8221;&gt;{{:name}}&lt;\/h1&gt;&lt;div&gt;&lt;span id=&#8221;dsToggle&#8221;&gt;toggle&lt;\/span&gt;&lt;\/div&gt;&lt;\/div&gt; {{=colcounter}}{{for sections}}&lt;div class=&#8221;ds-section&#8221;&gt;&lt;h3&gt;{{:label}}&lt;\/h3&amp;<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/de0c4d95afe2acb16200655fa2165ee6?s=128&amp;d=identicon&amp;r=PG\" \/><br \/>\nuser1213831<br \/>\njsrender<br \/>\nI am using jsRender and want to bind events like click, mouse over on elements that get render inside the template. while binding the event , I want to pass the data as a argument. Example :&lt;li id=&#8221;liv_{{:nid}}&#8221; onmouseover=[call some function and pass #data]&gt; &lt;div class=&#8221;qwqw&#8221;&gt;&lt;a href=&#8221;#&#8221;&gt;&lt;\/a&gt;&lt;\/div&gt; &lt;div class=&#8221;&#8221;&gt;&lt;p class=&#8221;we&#8221;&gt;{{:spd}} &lt;span&gt;mph (todo)&lt;\/span&gt;&lt;\/p&gt; &lt;\/div&gt;&lt;div class=&#8221;clear&#8221;&gt;&lt;\/div&gt;I tried the code as me<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/7af78a2adaedbee0b9faf52fd7967365?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nmartonx<br \/>\nphonegap jsrender<br \/>\nI would like to use JsRender in a PhoneGap Jquery Mobile project. When I run my application in a simple browser (for example Firefox), everything works fine. When I run the application in Android emulator I get the following error in console:D\/CordovaLog(603): file:\/\/\/android_asset\/www\/js\/program.js: Line 45 : TypeError: Result of expression &#8216;$(&#8220;#vehicletemplate&#8221;).render&#8217; [undefined] is not a function.Please advice. Is there anybody who try JsRender in Phonegap with Jquery Mobile on Android 2.1?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/1d37b39d3d352db9ceb0de20fab31696?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nwtfsven<br \/>\njavascript jquery jquery-plugins jsrender<br \/>\nI&#8217;d like to have my jsRender templates optionally include an &#8220;options&#8221; property to provide optional fall-backs if a property is not included; specifically rendering one element if the &#8220;options&#8221; property is included, or another if it is not. Everything works fine if the model passed in contains the property in question, but even {{if typeof ~options.someOption !== &#8216;undefined&#8217;}} gives me Error: Cannot read property &#8216;someOption&#8217; of undefined.Has anyone dealt with this? If so, how do you handle pr<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/a93168665d72b88039f104c1cd6906dc?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nbiegleux<br \/>\npicasa jsrender<br \/>\nI can&#8217;t figure this out, I am trying to get the pictures from googles picasa in json format. and using jsrender to render html out.I have this jsfiddle for you to look at.it&#8217;s is giving me undefined, and I used Chrome Developer Tools to analyze the data. I appreciate all the help.<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/ef3b76ac2c144fc09949a6f479c7e3be?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nkashif<br \/>\njavascript jsrender<br \/>\nI want to find out whether a string is empty or not i am trying to do{{if closedOn != &#8220;&#8221; }} but it is not giving me proper output<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/6539d3449b2bbdc01f92eb452bb6b975?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nthiagomcristo<br \/>\njavascript templates script nested jsrender<br \/>\nI have this code on jsFiddle: http:\/\/jsfiddle.net\/Ue3VN\/6\/ that&#8217;s not working properly.On my machine it gives the message: Error: Cannot read property &#8216;Description&#8217; of undefined.Does any know what should I do to reach the right results?Thank you very much.<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/020cc9c682c0b4cd79dcf50e9c229acb?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nPerelli<br \/>\njquery paging jsrender custompaging<br \/>\nI am trying to get jsRender and paging to work, but I am somewhat new to jsRender and jquery for that matter. I have tried to modify this to work with jsRender instead, but I am having only limited success.I am getting an exception when I click the &#8220;next page&#8221; link (see the code). The exception is &#8220;JsRender Error: Unknown template: &#8220;#items&#8221; &#8211; I think it happens because the code is overwritten on subsequent data fetch, but I am not sure how to fix it &#8211; any help is appreciated. Can anybody suggest<\/li>\n<\/ul>\n<p>Web site is in building<\/p>\n<p>I discovery a place to host code\u3001demo\u3001 blog and websites.<br \/>\nSite access is fast but not money<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.m5zn.com\/newuploads\/2014\/01\/30\/jpg\/e7da807964b1fff.jpg\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ina javascript jsrender I would like to use a variable from my jsrender template in order to produce a snippet of javascript, but I can&#8217;t figure out how to place a &lt;script type=&#8221;text\/javascript&#8221;&gt; within my &lt;script id=&#8221;data-item-tpl&#8221; type=&#8221;text\/x-jsrender&#8221;&gt;Hopefully the below is fairly clear. The below code produces an Uncaught SyntaxError. If I remove the tags [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6903","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6903","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=6903"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6903\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6903"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6903"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6903"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}