This is a migrated thread and some comments may be shown as answers.

Telerik - extract posts from Wordpress site

1 Answer 116 Views
HTML5, CSS, JavaScript
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Stephane
Top achievements
Rank 1
Stephane asked on 20 Dec 2015, 12:22 PM

Hi!

I am new to Telerik, and would like to test it out if it would help me with the projects I am doing. One important feature that I am testing is if I can connect the Telerik mobile app to a wordpress website. I found a tutorial from Telerik explaining just that over here.

However, when I test out the application that the writer post on Github, I just get a blank (white) screen.

The app uses the following in index.html:

<div id="tabstrip-posts"
        data-role="view"
        data-title="WP Posts"
        data-model="app.postsService.viewModel">
 
        <ul data-role="listview"
            data-style="inset"
            data-bind="source: postsDataSource"
            data-template="posts-template">
        </ul>
    </div>
 
    <!--Users template-->
    <script type="text/x-kendo-tmpl" id="posts-template">
        <a>
            <div>
                <div>
                    <span>${title}</span>
                </div>
                <div>
                    <span>${author.name}</span>
                </div>
            </div>
        </a>
    </script>

I also uses a posts.js, which includes:

(function (global) {
    var app = global.app = global.app || {};
 
    PostsViewModel = kendo.data.ObservableObject.extend({
        postsDataSource: null,
 
        init: function () {
            var that = this,
                dataSource;
            kendo.data.ObservableObject.fn.init.apply(that, []);
 
            dataSource = new kendo.data.DataSource({
                schema : {
                    model:
                    {
                        id: "id",
                        nicename: "nicename"
                    }
                },
                transport: {
                    read: function (options) {
                    $.ajax({
                        type: "GET",
                        url: "http://european-aluminium.onebonsai.com/api/get_recent_posts/",
                        dataType: "json",
                        success: function (result) {
                            options.success(result.posts);
                            console.log("read success");
                        },
                        error: function (result) {
                            console.log("read error: " + result);
                        }
                    });
                }
                }
            });
 
            that.postsDataSource = dataSource;
        }
    });
 
    app.postsService = {
        viewModel: new PostsViewModel()
    };
})(window);

Can it be that the new Telerik does not support such AJAX calls anymore? I do not even get a console error in this example...

Thanks!

1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 23 Dec 2015, 02:40 PM
Hello Stephane,

The project from the sample is an old one and that is probably why you had problems running it. I copied the source files into a blank AppBuilder app and it works for me. I am attaching the app to this message for your reference.

Regards,
Tsvetina
Telerik
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
Tags
HTML5, CSS, JavaScript
Asked by
Stephane
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or