javascript - How can I make an AJAX request made in javascript fail on purpose in the debugger to test it?
问题描述
Suppose if I wrote some code to handle the case where the AJAX request fails then how could I test it out? I was wondering if there was a way to make an AJAX request fail on purpose using the Chrome debugger.
解决方案
您可以使用network throttling
and go offline ,这将使 ajax 调用失败。
推荐阅读
- mysql - 提高数据库查询性能和内存使用率列出所有数据 laravel
- html - 如何在rails中进行下拉?
- video.js - video.js 和内容安全策略 (CSP) 的问题
- c# - 使用 asp.net,如何获取 WebRequest 对象的状态?
- azure-powershell - ARM模板deploymentScript PowerShell try catch被忽略?
- javascript - 如何通过 post 将图像二进制文件发送到 API?节点
- c# - 如何读取整个二进制文件(不仅是第一个变量),包括字符串、长整数和整数
- git - 如何提交更改到子模块而不是其父模块?
- java - JPQL 查询 CASE WHEN 始终为假
- python - 而不是直接绘制,需要绘制平滑折线图python