WordPress.org

Ready to get started?Download WordPress

Forums

JSON API
Help with giving a simple example (2 posts)

  1. Alitnt
    Member
    Posted 1 year ago #

    Hi
    i am using this plugin.
    i want to develop a web app showing latest post of my weblog with post title and photo using json api. but i dont know how do it (sorry)!
    can anyone give me a code example how to get latest posts and their comments, using HTML, CSS, Jquery.

    http://wordpress.org/extend/plugins/json-api/

  2. lego123
    Member
    Posted 1 year ago #

    This should help you out, it's the basic ajax call you need. Use firebug or press ctrl+shift+j in chrome to view the post object layout.

    $(function(){
    	$.ajax({
        	type:'get',
            dataType:"jsonp",
            url:'http://yourdomain.com/',
            data:{json:"get_recent_posts"},
            success:function(data){
            	if(data)
                	$.each(data.posts,function(k, v){
                    	console.log(v);
                    });
            }
        });
    });

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.