Trying to use backbone models
-
Hi
I can’t get the sample from the backbone api to work. I have the following javascript file that loads since the confidence check comes back OK:
jQuery(document).ready(function( $ ) { // $ Works! You can test it with next line if you like console.log($); var post = new wp.api.models.Post( { ID: 1 } ); post.fetch().done( function() { // post.attributes contain the attributes of the post console.log( post.attributes ); }); });
However I get a Type undefined error for the wp.api? So I guess that the library isn’t loading correctly.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Trying to use backbone models’ is closed to new replies.