A quick introduction to Ajax:
Simply put, an Ajax request sends a request through an XMLHttpRequest object, which has four states (readyStates) :
0- uninitialized, 1- initializing, 2- sending data, 3- sending data, 4- done.
When XMLHttpRequest. ReadyState is 4, said ajax request has been completed can get the result.
Ajax’s success and Error methods are triggered based on the response status code. Success () is triggered when XMLHttprequest.status is 200, indicating a successful response. Other status codes trigger error().
In addition to the response status code, Ajax can also use an error method in the following situations:
- return data type is not JSON network interrupt background response interrupt
Read More:
- React Native: TypeError: Network request failed
- JS Ajax request is successful, the response displays “failed to load response data”
- Django + jQuery get data in the form + Ajax send data
- HTTP 405 Error: Failed to load resource: the server responded with a status of 405 (Method Not Allowed)
- React Native Network Request Failed solution
- Four ways to get Django parameters in request
- Error: required request body is missing, @ requestbody annotation usage
- Router DIO network request: dioerror[ DioErrorType.RESPONSE ]: HTTP status error [400] or [500]
- Encapsulation of Ajax JSON / fromdata request in native JS
- Solve the problem of flag error valueerror: View function did not return a response
- Use XMLHttpRequest of JavaScript to send data to the background
- HTTP 400 error – bad request
- Uncaught Error: _registerComponent(…): Target container is not a DOM element
- NS_ERROR_DOM_BAD_URI: Access to restricted URI denied
- The remote server returned an error: (417) Expectation failed
- ajax error 400 (Failed to load resource: the server responded with a status of 400 (Bad Request))
- can’t set headers after they are sent
- HTTP error code compact version
- The problem that headers [‘content-type ‘] does not work is set in the Axios get method request interface
- Login authority verification