jQuery Refresh/Reload Page if Ajax Success after time

前端 未结 7 605
心在旅途
心在旅途 2020-12-14 02:42

I use Jquery to make an Ajax request. The server returns Json object with value "true or false" like this:

return Json(new { success = false, JsonRe         


        
7条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-14 03:22

    var val = $.parseJSON(data);
    if(val.success == true)
    {
     setTimeout(function(){ location.reload(); }, 5000);
    
    }
    

提交回复
热议问题