我在响应本机中通过<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="js/jquery.min.js"></script>
</head>
<body>
<form name = "myform">
Domain Name: <select name="domaindrop" id="domain">
<option value="">--- Please select ---</option>
<option value="Robotics" selected="selected">Robotics</option>
<option value="Coding">Coding</option>
<option value="Gaming">Gaming</option>
<option value="General Events">General</option>
</select><br><br>
<input type="submit" name="submit" class="button" value="CHECK EVENT LIST" onclick ="validate()">
Event Name: <select name="eventdrop" id = "event">
<option value="">--- Please select ---</option>
<option class="A" value="A">A</option>
<option class="B" value="B">B</option>
<option class="C" value="C">C</option>
<option class="D" value="D">D</option>
<option class="E" value="E">E</option>
<option class="F" value="F">F</option>
<option class="G" value="G">G</option>
<option class="H" value="H">H</option>
</select><br><br>
</form>
<script >
function validate(){
if (document.myform.domaindrop.value == "") {
document.myForm.domaindrop.focus();
}
else if(document.myform.domaindrop.value == "Robotics")
{
$('B').attr("disabled","disabled");
$('C').attr("disabled","disabled");
$('F').attr("disabled","disabled");
$('G').attr("disabled","disabled");
}
}
</script>
</body>
</html>
调用api,但抛出以下错误:
网络请求失败
中
-onerror中的node_modules \ whatwg-fetch \ fetch.js:439:29
-dispatchEvent中的node_modules \ event-target-shim \ lib \ event-target.js:172:43
-setReadyState中的node_modules \ react-native \ Libraries \ Network \ XMLHttpRequest.js:567:29
-__didCompleteResponse中的node_modules \ react-native \ Libraries \ Network \ XMLHttpRequest.js:397:25
-
中的node_modules \ react-native \ Libraries \ Network \ XMLHttpRequest.js:503:16 -node_modules \ react-native \ Libraries \ vendor \ emitter \ EventEmitter.js:180:12 在发出
-node_modules \ react-native \ Libraries \ BatchedBridge \ MessageQueue.js:351:47 在__callFunction
中 -node_modules \ react-native \ Libraries \ BatchedBridge \ MessageQueue.js:116:26 在
-node_modules \ react-native \ Libraries \ BatchedBridge \ MessageQueue.js:314:6 在__guardSafe
中 -node_modules \ react-native \ Libraries \ BatchedBridge \ MessageQueue.js:115:17 在callFunctionReturnFlushedQueue
我们的前端代码在localhost上,而API在服务器上。我在前端使用React native,在后端使用Django。