且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

而jQuery的AJAX运行时加载GIF图像

更新时间:2023-12-05 10:40:10

我有一个解决方案,它可能无法做到这一点的***办法,但它在这种情况下工作。

I have a solution, it may not be the best way to do it but it has worked in this case.

$('input').keyup(function () {

  $('#response').text('loading...');

  $.ajax({
    url: "/answer_checker.php",
    global: false, type: "POST", 
    data: ({...clipped...}), 
    cache: false,
    success: function(html) {
      $('#response').html(html);
    }
  });
});

通过调用Ajax的功能,但它仍然显示,直到Ajax调用更新相同内容的加载文本之前设置resonce内容。

By setting the resonce content before calling the ajax function it remains showing the loading text until the ajax call updates the same content.

谢谢大家谁花时间来回答。

Thanks to everyone who took the time to answer.

阿伦