Hello I am stuck with an android application I am trying to build using phonegap. The application I try to build retrieves a feed from a wordpress site which i have installed locally. I have already installed and tested JSON-API plugin and it worked correctly.
But when i created an android application using phonegap with eclipse I do not get the feed loaded via javascript.
I have created an html file under projectfolder/assets/www folder where the code is
<!DOCTYPE HTML>
<html>
    <head>
        <script src="jquery.js"></script>
        <script src="cordova.js"></script>
        <script>
                jQuery.support.cors = true;
                var target_div = "#contents";
                var nextID = null;
                var prevID = null;
                var api_read_url = "http://127.0.0.1/wordpress_phonegap/?json=get_post&dev=1&id=";
                var init_url = "http://127.0.0.1/wordpress_phonegap/?json=get_post&dev=1&p=1";
                function getID(url) {
                    var str = new String(url);
                    var x = str.split("=");
                    var id = x[1];
                    return id;
                }
            function readSinglePost (url,target_div) {
                var URL = url+"&callback=?";
                console.log(URL);
                jQuery.ajax({
                        url: URL,
                        dataType: "json",
                        jsonp: null,
                        jsonpCallback: null,
                        success: function(data) {
                            alert(data);
                            jQuery(target_div).html("");
                            try{
                                jQuery(target_div).append("<h1>"+data.post.title+"</h1>");
                                jQuery(target_div).append(data.post.content);
                                jQuery(target_div).append("<small>"+data.post.date+"</small>");
                            } catch (e){
                                console.log("error console");
                            } 
                            try {
                                nextID = getID(data.next_url);
                            }
                            catch (e) {
                                ;
                            }
                            try {
                                prevID = getID(data.previous_url);
                            }
                            catch (e) {
                                ; // you should include some of your own error-handling code or
                            }
                } ,
                        error: function(error){
                            console.log("error console");
                        }
            });
            }
            //Renew next and previous buttons
            function getNext(){
                jQuery("#next").click(function(){
                    var id = nextID;
                    var nextURL = api_read_url + id;
                    readSinglePost(nextURL, target_div);
                });
            }
            function getPrevious(){
                jQuery("#previous").click(function(){
                    var id= prevID;
                    var prevURL = api_read_url + id;
                    readSinglePost(prevURL, target_div);
                })
            }
            jQuery(document).ready(function() {
                readSinglePost(init_url, target_div);
                getNext();
                getPrevious();
            });
        </script>
    </head>
    <body>
        <div id="main">
            <button type="button" id="previous">Previous</button>
            <button type="button" id="next">Next</button>
            <div id="title"></div>
            <div id="contents"></div>
        </div>
    </body>
</html>
When I open this file using firefox and firebug I obtain the following error in the console.
SyntaxError: invalid label
"status": "ok",
I understand what has happened. As it is a crossbrowser interaction json gets sent in jsonp format and thus the json value gets sent wrapped in a function. How can i get the value correctly?
I have read several threads and articles but unfortunately I have found no solution. The example comes from the tutorial included in the book "WordPress Mobile Applications with PhoneGap"
