jQuery Ajax 함수를 작성하여 페이지의 코드가 페이지에서 몇 번 호출되기 때문에 페이지의 코드 양을 줄이려고합니다. 나는 그것이 작동하도록 할 수 없습니다. 여기에 내가 가지고있는 코드가 있습니다 :jQuery Ajax 함수
var loadURL = $(this).attr('href');
function load(){
$.ajax({
url: loadURL,
type: 'GET',
cache: true,
data: {
delay: 4
},
success: function(data) {
$('#load').html(data)
}
});
return false;}
$('#one').click(function(){ load(); });
$('#two').click(function(){ load(); });
$('#three').click(function(){ load(); });
<a href="one.php" id="one">Two</a>
<a href="two.php" id="two">Two</a>
<a href="three.php" id="three">Two</a>
누구나 나를 안내 할 수 있습니까?
(이 주목할 가치가있다) .attr ('href'); – kobe