prototype ใ่ส่ code รูป ตอน loading ที่ไหนครับ



function getShowCat(){

      new Ajax.Request("show_cat_action.php",

      {

         method: "post",

         onSuccess: function(objRequest){

            $("showCat").innerHTML  = objRequest.responseText;

         }

      });

   }

กรกฎ วิริยะ 19 Oct 2010 07:15
function getShowCat(){

      // show loading

      new Ajax.Request("show_cat_action.php",

      {

         method: "post",

         onSuccess: function(objRequest){

            // hide loading

            $("showCat").innerHTML  = objRequest.responseText;

         }

      });

   }
wave zaa 19 Oct 2010 07:16


อยากให้มัน delay ได้ไหมครับ ทำงัยครับ

กรกฎ วิริยะ 19 Oct 2010 07:52
delay ก็ใช้ ฟังก์ชั่น setTimeout สิครับ ...



ว่าแต่จะ delay ไปทำไม ถ้าทดสอบ บน localhost ตัว loading อาจแสดงแค่แปบเดียว เนื่องจาก latency มันน้อย แต่ถ้าใช้บน Server จริงๆ latency จะสูงขึ้น ซึ่งจะทำให้ loading ทำงานนานขึ้นเองแหละครับ