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

How to Render Content from a Separate File

2 Answers 101 Views
SPA
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 01 Apr 2013, 06:48 PM
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.render($("#app"));
    layout.showIn("#content", fooView);
});

I get  as expected:
Header
foo
Footer

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 Answers, 1 is accepted

Sort by
0
mgs
Top achievements
Rank 1
answered on 02 Apr 2013, 06:48 AM
Hello Paul,

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

Michael G. Schneider
0
Holger
Top achievements
Rank 1
answered on 02 Apr 2013, 01:54 PM
Another possibility is to use the require.js "text" plugin.
Tags
SPA
Asked by
Paul
Top achievements
Rank 1
Answers by
mgs
Top achievements
Rank 1
Holger
Top achievements
Rank 1
Share this question
or