jqueryhtmlvisual-studiowebmatrix-3

What is the most straightforward way to assign html to an HTML element?


I have an html file in my project's Contents folder. I have a div with an ID of "FictionContent" that I want to assign the contents of that HTML file.

Is the following a good way to do that:

$('#FictionContent').html('Content/huckfinn.html');

?

Will the jQuery understand "Content" as a subfolder and thus know where to grab the html? If not, what is a workaround for doing something as similar as possible?


Solution

  • Try this:

    $('#FictionContent').load('Content/huckfinn.html');