javascript - 获取简单 GET 请求的 NS_BINDING_ABORTED 错误
问题描述
为什么我会收到此错误?
这是我在 Firefox 中的“网络”选项卡的屏幕截图,显示了 NS_BINDING_ABORTED
我在这个线程中查看了NS_BINDING_ABORTED Shown in Firefox with HttpFox但我根本不知道它在说什么......
有人可以帮我吗?
谢谢
$(function() {
let userName = null;
let userStatus = null;
$("#search").on("click", function() {
userName = $("#username").val();
apiCall();
});
$(".dropdown-menu a").on("click", function() {
$("button.dropdown-toggle").text($(this).text());
userStatus = $("button.dropdown-toggle").text();
});
function apiCall() {
if (userName !== null && userStatus !== null) {
var api = `https://api.jikan.moe/v3/user/${userName}/animelist/${userStatus}`;
fetch(api, {
method: "GET",
headers: {
Accept: "application/json",
},
})
.then(response => response.json())
.then((data) => {
console.log(data)
})
.catch((error) => {
console.log(error);
})
}
}
});
解决方案
我在 $.get() ajax 调用中遇到了同样的问题。它位于从表单内的按钮触发的函数内。我将按钮移到表单标签之外,问题就消失了。
推荐阅读
- javascript - Outlook 加载项桌面 - 显示 google oauth 2 对话框
- java - QuerySyntaxException:意外令牌:FROM
- cloud - JIRA 云与 Tenable.io 的集成
- postgresql - 查询在存储过程的 POSTGRESQL 中没有结果数据的目的地
- sql - 如何使用 SQL 将长格式数据插入两个单独的表中?
- c++ - MacOS / Qt 5.14.1 项目的蓝牙断开问题
- java - 如何使用包含标签进行递归(foreach 循环)?树形结构-JAVA
- javascript - 在 Vuetify 的日历上从外部删除事件
- go - 如果运行时不抛出(“并发映射写入”)而是恐慌(“并发映射写入”)会发生什么
- java - 如何在没有显式控制器建议方法的情况下将异常映射到响应状态代码?