Problem with JSONP data

1 posts, 0 answers
  1. Matthieu
    Matthieu avatar
    1 posts
    Member since:
    Apr 2012

    Posted 16 Jul 2012 Link to this post

    Hy,

    i have some troubles by recovering a remote JSON file and my list view.
    Here's my code (index.html) :

    <ul data-role="listview" data-style="inset" id="selogerlistview"></ul>
     
    <script type="text/x-kendo-template" id="listviewseloger">
        <img class="item-leftimg" src="${nom_article}"/>
        <h3 class="item-title"><a>${nom_article}</a></h3>
        <span class="item-bubble">${nom_article}</p>
    </script>

    And my JS :
    function init_seloger() {
                var dataSource = new kendo.data.DataSource({
                    transport: {
                        read: {
                            url: "http://www.mylorraine.fr/api/jsonp_matth.php",
                            dataType: "jsonp",
                            contentType: "application/json; charset=utf-8",
                            type: "GET"
                        }
                    },
                    error: function(e) {
                       console.log(e);
                },
                schema: {
                    data: "categories_article"
                }
                });
                         
            $("#selogerlistview").kendoMobileListView({
                dataSource: dataSource,
                template: $("#listviewseloger").text(),
                endlessScroll: false,
                click: function(e) {     
            }
            });
        }

    As a result, i have a parse error :( and a Javascript Syntax error (capture2.jpg)
    When i change the JSON file with parenthesis, i have no more Javascrip label error, but a jquery parse error  (capture1.jpg).

    Please, someone could help me ?



Back to Top