WordPress.org

Ready to get started?Download WordPress

Forums

JSON API
[Cordova\Eclipse] Uncaught SyntaxError (1 post)

  1. harding13
    Member
    Posted 1 year ago #

    i'm trying to retrieve post data from an online WordPress blog for an Android app. I'm using Cordova 3.0

    the simple code is

    function readSinglePost(target_div){
    	jQuery.ajax({
    		url: 'http://www.example.com/?json=get_post&callback=show_posts_widget&p=1&dev=1',
    		type: 'GET',
    		dataType: 'jsonp',
    	success: function(data) {
    console.log(JSON.stringify(data));
    		jQuery(target_div).append(data.post.content);
    		jQuery(target_div).append("<small>"+data.post.date+"</small>");
    console.log(data.post.content);
    		},
    	error: function(){
    		$('#response').text('There was an error loading the data.');
    		alert('There was an error loading the data');
    	}
    		});
    }

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

    but in Eclipse error console i got always

    E/Web Console(2262): Uncaught SyntaxError: Unexpected token < at http://www.example.com/?json=get_post&callback=show_posts_widget&p=1&dev=1&callback=jQuery1720431144411675632_1374493900865&_=1374493901342:1

    i don't know why the second "callback" parameter was appended

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic