how to find out if XMLHttpRequest.send() worked

前端 未结 3 1816
小蘑菇
小蘑菇 2020-12-05 10:19

I am using XMLHttpRequest to send a file from javascript code to a django view.I need to detect,whether the file has been sent or if s

3条回答
  •  北荒
    北荒 (楼主)
    2020-12-05 11:02

    XMLHttpRequest objects contain the status and readyState properties, which you can test in the xhr.onreadystatechange event to check if your request was successful.

提交回复
热议问题