1. #1
    Sencha User
    Join Date
    Feb 2011
    Posts
    14
    Vote Rating
    0
    Vinzcent is on a distinguished road

      0  

    Default JSON Request with Wordpress JSON API

    JSON Request with Wordpress JSON API


    Hello,

    I am new to Sencha Touch, but I am very excited about it.
    As my first application I would like to make a little app with the posts of my wordpress site. I am using a JSON API plugin to get the JSON. http://wordpress.org/extend/plugins/json-api/


    I use a template to show the posts
    Code:
    	var postsComponent = new Ext.Component({	    
    	    title: 'Posts',
    	    scroll: 'vertical',
    	    tpl: [
    		'<tpl for=".">',
    		'	<div>',
    		'		<p>{title}</p>',
    		'	</div>',
    		'</tpl>'
    	    ]
    	
    	});
    
    getPosts();

    And here I get the data for my template
    Code:
    	getPosts = function(){
    	    
    	    Ext.util.JSONP.request({
    		url: 'http://winckelmans.net/wordpress/?json=get_recent_posts',
    		callback: function(data){
    		    postsComponent.update(data.posts);
    		}
    	    });
    	    
    	}
    getPosts();
    But it seems like the callback function is never executed.
    What am I doing wrong?

    Thanks,
    Vincent

  2. #2
    Sencha User
    Join Date
    Feb 2011
    Posts
    2
    Vote Rating
    0
    rudiboot is on a distinguished road

      0  

    Default This works for me

    This works for me


    Ext.util.JSONP.request({
    url: 'http://your-url.com/api/get_recent_posts/',
    callbackKey: 'callback',
    callback: function(data) {
    var posts = data.posts;;
    updates.update(posts);
    }
    });

  3. #3
    Sencha User
    Join Date
    Feb 2011
    Posts
    14
    Vote Rating
    0
    Vinzcent is on a distinguished road

      0  

    Default


    Thank you
    when I use http://your-url.com/api/get_recent_posts/ as url, it works. Weird

  4. #4
    Sencha User
    Join Date
    Jul 2011
    Posts
    3
    Vote Rating
    0
    kennyp is on a distinguished road

      0  

    Default Share template files &/or wisdom into Wordpress/JSON/Sencha Touch

    Share template files &/or wisdom into Wordpress/JSON/Sencha Touch


    Hi guys,
    I'm wondering if you'd be willing to share your learnings & even example files around using Wordpress, JSON & Sencha Touch to create apps.

    I'm looking to create an app using this method (then hopefully compiling into a native app using PhoneGap) for a non-profit over the next couple months, as both a personal challenge & to help them in their mission. Wordpress (with the JSON API) just seems like such an obvious content repository.. would be really cool to prove it out.

    Would you guys be game to share (ideally template files, but even just wisdom or pointers)? Of course, anything I end up using & modifying, I'll share back with you.

    Looking forward to hearing from you!

    Kenny

  5. #5
    Sencha User
    Join Date
    Dec 2011
    Posts
    1
    Vote Rating
    0
    Jeronimo79 is on a distinguished road

      0  

    Lightbulb Tutorial

    Tutorial


    Hey Guys,

    I'm pretty new to JS and ST and want to create an app for my wordpress blog. I installed the JSON API too but not sure or well enough to use it in ST. It would be really nice to get some further informations how to handle the JS in ST to get a view of my posts. Especially a sample code would be awesome!

    Thanks!!!

  6. #6
    Sencha User
    Join Date
    Feb 2011
    Posts
    14
    Vote Rating
    0
    Vinzcent is on a distinguished road

      0  

    Default


    I think it shoukd be something like this:

    Code:
    Ext.setup({	onReady: function() {
    
    
    		Ext.regModel('Posts', {
    			fields: ['id', 'type', 'slug', 'url', 'status', 'title', 'content', 'date']
    		});
    		
    		var store = new Ext.data.JsonStore({
    			model  : 'Posts',    	
    			proxy: {
    			type: 'scripttag',
    			url : 'http://wordpressblog.url.net/?json=get_recent_posts',
    			reader: {
    				type: 'json',
    				root: 'posts'
    			}
    			}
    		});
    		store.load();
    		
    		var list = new Ext.List({
    			itemTpl : '{title} <span class="date">{date}</span>',
    			store: store
    		});
    		
    		var listPanel = new Ext.Panel({
    			title: 'All Posts',
    			fullscreen: true,
    			dockedItems: [
    			{
    				dock : 'top',
    				xtype: 'toolbar',
    				title: 'My blog'
    			
    			}],
    			
    			items: [list]
    		});   
    
    
    
    
    	}
    });

  7. #7
    Sencha User
    Join Date
    Apr 2012
    Posts
    4
    Vote Rating
    0
    StewartWeill is on a distinguished road

      0  

    Default Same issue

    Same issue


    I'm having the same confusion as Vinzcent, I get no errors, but no data either. Should I be using a script to tease out the var/value pairs in the array?

    Forgive me but I am noob.

  8. #8
    Sencha User
    Join Date
    Oct 2012
    Posts
    1
    Vote Rating
    0
    zrmedia is on a distinguished road

      0  

    Default


    I just doing with sencha 1 week and try make a app for my website. But i have a problem with paging and load more content if you work with wordpress json api. you must change url like this:/api/get_category_posts/?id=1&page=1 to /api/get_category_posts/?id=1&page=2 to get data from page 2.Anybody here can help me for problem. Thanks.

Similar Threads

  1. Cache JSON request
    By mck89 in forum Ext 3.x: Help & Discussion
    Replies: 6
    Last Post: 20 Apr 2010, 2:48 AM
  2. Replies: 2
    Last Post: 13 Aug 2009, 8:49 AM
  3. JSON return on Request
    By tzander in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 17 Jul 2008, 3:45 AM
  4. Basic AJAX JSON request
    By OutpostMM in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 18 Mar 2008, 8:01 AM
  5. corrupted JSON request?
    By mherger in forum Ext 1.x: Bugs
    Replies: 6
    Last Post: 3 May 2007, 2:57 PM

Thread Participants: 5

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi