setTimeout() not timing out

setTimeout() not timing out

Hi,

In using setTimeout() to show and hide a message the message just flashes on and off. Timer is not working.

Hope someone can spot something wrong here.

  UPDATE:

I commented out  window.location.assign("fields.php");  and setTimeout works properly.  See 5. below.


  1.    
    if(update) {
       
        $.ajax({
            type: "POST",
            url: "changeData.php",
            data: { "col":col, "update":update},
            dataType: "text",
            success: showChangedData
        }); // ajax   
               
        function showChangedData(data) {
       
        successMsgShow();
           
        } // showCh       

    }
    else {

  2.     $('#succMsg').append("<h5><span style='color:red'>You Didn't Enter revised Data.</span></h5>");

  3. }

    });// indata


    //  ===============  Success Message with Time Delay  ===================
         
    function successMsgShow() {
     
         $("p").append('<h3> <span style="color:red">Data Revised Successfuly</span></h3>');
     
     setTimeout(successMsgHide, 5000); // show message for 5 seconds
  4. //  Flashes on screen w/ no delay

  5. window.location.assign("fields.php"); // run page again showing revised data
    }

    function successMsgHide() {

        $("p").hide();  
       
    }