更新时间:2023-12-04 23:17:16
首先,您的代码结构无效
First, your code has invalid structure
$(document).ready(function() {
function space_load() {
$('#SPACE_TOTAL').load('http://www.klossal.com/portfolio/space.html');
}
space_load(); //Now call the function
});
但是,您可以将其修整
$(function() {
$('#SPACE_TOTAL').load('http://www.klossal.com/portfolio/space.html');
});
但是,由于您希望在单击元素时执行此操作. 这是您需要的:
But, since you want this on click of an element. This is what you need:
$(function() {
$("#yourlinkid").click(function() {
$('#SPACE_TOTAL')
.html('<img src="preloader.gif" />')
.load('http://www.klossal.com/portfolio/space.html');
});
});