AJAX ifModified how to use?



  • There's a code like this:

    function show()
    {
        $.ajax({
            dataType: 'json',
            url: "info.php",
            ifModified: true,
            cache: false,
            success: function(jsondata, status){
                if (status === "success") {
                    $("#queue").css("display", "none");
                    $("#queue").html(jsondata.queue);
                    $("#queue").fadeIn(500);
                } else {
                    $("#queue").html(jsondata.queue);
                }
            }
        });
    }
    

    $(document).ready(function(){
    show();
    setInterval('show()', 3000);
    });

    <div id="queue"></div>

    It is necessary that when new information is received, there will be a smooth appearance, unless the data has changed, nothing has happened. How do you do that?



  • You can just compare Html's contents to current, since you still get ready html in response and only if there are differences to animate.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2