2013-08-16 4 views
0

다음 코드는 load() 함수 내에 양식을 제출하는 코드입니다. 나에게 다음 로더 .gif을 보여 (이 로딩되는 동안)양식을 제출하는 동안 로더 표시

$(document).ready(function(){ 
$("#productfilter").validate({ 
submitHandler: function(form) { 
$.post ('listproresult_core.php', $("#productfilter").serialize(), function(data) { 
$('#contentincore').html(data); 
$('#contentincore a').click(function(e) { 
$("#contentincore").on("click", "a:not(.minlink)" && "a:not(.prolink)", function (e) { 
$("#contentincore").load($(this).attr("href")); 
e.preventDefault(); 
}); 
}); 
}); 
} 
}); 
}); 

는 ... 그러나, 내가 원하는 응답 형태입니다.

$("#contentincore").html("<img src='loader.gif'class='clock' border='0' />"); 
+0

:

은 JS의 준비 기능에 HTML 코드 enter image description here

  • 의 이미지를 보면 다음과 같은 코드를 삽입 아무 규칙도 없는가? – undefined

  • +0

    그냥 내가 제출 한 것을 보여주고 싶기 때문에로드를 제출하기 전에 예제를 작성하십시오. – Deviandorx

    답변

    1

    사용 아약스 양식을 게시하고 당신은 'beforeSend'

    $.ajax({ 
        type: "POST", 
        url: "listproresult_core.php", 
        data: $("#productfilter").serialize(), 
    
        beforeSend: function() {         
         $("#contentincore").html("<img src='loader.gif'class='clock' border='0' />");          
        }, 
    
        success: function(result) {      
         $("#contentincore").html("");   
        }      
    }); 
    
    +0

    죄송합니다. 코드를 시도하고 응답을 POST하지 않았습니다. 코드를 확인하고 잘 작성되었는지 확인하십시오. – Deviandorx

    +0

    안녕하세요, 코드가 정확합니다. 결과는 POST의 응답입니다. 현재 시스템 내에서 코드를 작동시키는 것은 당신에게 달려 있습니다. 어쩌면 변수가 게시되고 있는지 다시 확인해야합니다. – papawheelie

    +0

    질문 새로 고침 – Deviandorx

    0
    1. 로드의 IMG의 지프를 포함하는 사업부를 만들고 실행할 수 있습니다. 발리시를 사용하는 목적은 무엇

    $('#loadingDiv') 
        .hide() // hide it initially 
        .ajaxStart(function() { 
         $('#loadingDiv').show(); 
        }) 
        .ajaxStop(function() { 
         $('#loadingDiv').hide(); 
        }) 
        .ajaxError(function() { 
         alert('Ajax Error'); 
        }); 
    
    관련 문제