How to Render Content from a Separate File

3 posts, 0 answers
  1. Paul
    Paul avatar
    1 posts
    Member since:
    Jan 2011

    Posted 01 Apr 2013 Link to this post

    I'm working with the layout example and seem to be missing something very basic.  If I run:

    $(document).ready(function (){    
        var fooView = new kendo.View("<span>foo</span>");
        var layout = new kendo.Layout("<header>Header</header><section id='content'></section><footer>Footer</footer>");
        layout.showIn("#content", fooView);

    I get  as expected:

    What I can't figure out is the how to replace:
    var fooView = new kendo.View("<span>foo</span>");

    with an external file (i.e. foo.html that contains <span>foo</span>)

    What is the syntax to load content from an external html file into the content section of a layout?

    Thanks for your help.
  2. mgs
    mgs avatar
    163 posts
    Member since:
    Jan 2011

    Posted 02 Apr 2013 Link to this post

    Hello Paul,

    you have to access that file with some Ajax call. For example, you can use jQuery's $.get method.

    Michael G. Schneider
  3. Holger
    Holger avatar
    78 posts
    Member since:
    Nov 2012

    Posted 02 Apr 2013 Link to this post

    Another possibility is to use the require.js "text" plugin.
Back to Top