javascript - AJAX in Bootstrap dropdown not working -
i trying use ajax dynamically load html pages click of bootstrap dropdown, doesn't seem work. ideas?
<ul class="dropdown-menu"> <li><a onclick = "$('#ajax').load('index.html');" href = "#">project 1</a></li> <li><a href="index.html">project 2</a></li> <li><a href="#2">project 3</a></li> <li class="divider"></li> </ul>
and later create div ajax load in.
<div class = "container"> <div class = "demo-row"> <div class = "col-xs-8" id="ajax"> </div>
finally, ajax (on separate file).
function loadajax(file) { $(document).ready(function() { //target div id of result //and load content specified url //and specified div element it: var filename = new string(file); var ending = " #ajax > *"; filename = filename.concat(ending); $('#ajax').load(filename); }); }
Comments
Post a Comment