Loading An External .htm With Javascript Into A Div
I am trying to load an external .htm file to a div on my main page, and I have used the following code: Link
Solution 1:
Why not
html
<ahref="file.htm"class="ajax">Link</a>
and add a script
<scripttype="text/javascript">
$(function(){
$('.ajax').click(function(e){
e.preventDefault();
$('#content').load( this.href );
});
});
</script>
this way you can set a class ajax
to all the links that load inside the #content
area and it handle all of them..
Could it be that the reason it does not work is that you click too soon and the jquery is not yet loaded ?
Post a Comment for "Loading An External .htm With Javascript Into A Div"