{"id":1118,"date":"2022-08-30T15:12:41","date_gmt":"2022-08-30T15:12:41","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/json-to-backbone-model-for-load-config-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:12:41","modified_gmt":"2022-08-30T15:12:41","slug":"json-to-backbone-model-for-load-config-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/json-to-backbone-model-for-load-config-collection-of-common-programming-errors\/","title":{"rendered":"json to backbone model for load config-Collection of common programming errors"},"content":{"rendered":"<p>I want to set configs in Model with $.get() :<\/p>\n<pre><code>    var config= Backbone.Model;\n    var c = new config();\n    $.get(\"config.json\", function(data){\n            c.set(data);\n    });\n    console.log(c.get('glossary'));\n<\/code><\/pre>\n<p>Return Undefined, but console.log(c) return the good Backbone Model.<\/p>\n<p>Content of JSON file is the example : http:\/\/www.json.org\/example.html<\/p>\n<p>Thanks<\/p>\n<p id=\"rop\"><small>Originally posted 2013-11-09 23:30:09. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I want to set configs in Model with $.get() : var config= Backbone.Model; var c = new config(); $.get(&#8220;config.json&#8221;, function(data){ c.set(data); }); console.log(c.get(&#8216;glossary&#8217;)); Return Undefined, but console.log(c) return the good Backbone Model. Content of JSON file is the example : http:\/\/www.json.org\/example.html Thanks Originally posted 2013-11-09 23:30:09.<\/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-1118","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1118","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=1118"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1118\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1118"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1118"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1118"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}