아약스를 사용하여 페이지를로드하고 있습니다. 하지만 내 페이지가로드 될 때 jQuery가 작동하지 않는로드 된 페이지 템플릿에 있습니다. 페이지를 새로 고침하면 작업이 시작됩니다. JQuery가 아약스 페이지로드와 작동하지 않습니다.
나는대로 준비 기능을 사용하고 있습니다 :jQuery(document).ready(function() {
jQuery('#tabs li a:not(:first)').addClass('inactive');
jQuery('.tab-content').hide();
jQuery('.tab-content:first').show();
jQuery('#tabs li a').click(function() {
var t = jQuery(this).attr('id');
if (jQuery(this).hasClass('inactive')) {
jQuery('#tabs li a').addClass('inactive');
jQuery(this).removeClass('inactive');
jQuery('.tab-content').hide();
jQuery('#' + t + 'C').fadeIn('slow');
}
});
});
하지만 난 페이지 링크를 클릭해서 페이지를 새로 고침하지 않고 Ajax를 사용하여로드 될 때 그것은 어떤 경고를 표시되지 않습니다.
$.ajax({
url: url,
success:
function(data){
$('#tabs li a:not(:first)').addClass('inactive');
$('.tab-content').hide();
$('.tab-content:first').show();
$('#tabs li a').click(function(){
var t = $(this).attr('id');
if($(this).hasClass('inactive')){
$('#tabs li a').addClass('inactive');
$(this).removeClass('inactive');
$('.tab-content').hide();
$('#'+ t + 'C').fadeIn('slow');
}
});
}
function(data, textStatus, jqXHR){
alert("working");
},
error: function(jqXHR, textStatus, errorThrown){
document.location.href = url;
return false;
}
: 내가 JQuery와 가능한 난 단지 그들 중 하나가 동시에 둘 중을 wokring되는 AJAX 호출의 성공에이 개 기능을로드 할 수
도와주세요 만들 수있는 방법
어떻게 가능할까요?
아약스를 사용하는 경우 위 코드를 성공 내부에 넣을 수 있습니다. –
준비 기능이 없을 것입니다 rgiht? – Qasim
@ 다른 문서도 나와 있습니다. – Qasim