How to cancel a jquery.load()?

前端 未结 7 1040
清酒与你
清酒与你 2020-11-29 07:30

I\'d like to cancel a .load() operation, when the load() does not return in 5 seconds. If it\'s so I show an error message like \'sorry, no picture loaded\'.

What I

7条回答
  •  没有蜡笔的小新
    2020-11-29 08:16

    I think the simplest thing to do would be to use $.ajax directly. That way you can start a timeout, and from the timeout set a flag that the handler on the ajax call can check. The timeout can also show a message or whatever.

提交回复
热议问题