Loading external Html with Jquery and Asp.net MVC -
in index view have this:
<script type="text/javascript" src="~/scripts/jquery-2.0.0.js"></script> <script type="text/javascript" src="~/scripts/javascript1.js"></script> <div id="dictionary"> </div> <div class="letter" id="letter-a"> <a href="#">a</a> </div>
in javascrip11.js have this:
$(document).ready(function () { $('#letter-a a').click(function () { $('#dictionary').load('htmlpage1.html'); alert('loaded!'); return false; }); });
and in htmlpage1 have this:
<div>definitions letter a</div>
i want javascript load htmlpage1 , insert div dictionary of page when click anchor tag.....i have htmlpage1 both in scripts folder , in viewfolder.. both doesnt work.... getting alert snipet not being inserted....
when loading static file in mvc using absolute path. put htmlpage1.html file in root of site , should work
of course can use subfolders (or controller-action, sounds hacky though):
$('#dictionary').load('views/htmlpage1.html');