Today, when I was working, I encountered a problem. I used $. Ajax to transfer data to the background, which can operate correctly in the background, but success did not respond, and error responded. After checking the document, I realized that after jQuery version 1.4, all the returned JSON formats must meet the requirements json.org Success can only be called back correctly in the format of, otherwise jQuery will think that it returns an error Here is an example:
JSONObject j = new JSONObject(); j.put("msg","SUCCESS"); PrintWriter out = response.getWriter(); out.write(j.toString());
This is correct. JQuery calls back success
String j = "123"; PrintWriter out = response.getWriter(); out.write(j);
This is wrong, jQuery will think it is wrong
- Difference between contenttype and datatype in Ajax request of jquery
- Summary of jQuery autocomplete plug-in
- TypeError: r.indexOf is not a function TypeError: r.indexOf is not a function
- If the request parameter is formdata, use the Ajax operation
- Vue cannot read property ‘xxx’ of undefined solutions
- JS to determine whether the string contains a character
- How to Fix “HTTP 405 method not allowed” Error
- How to use Runtime.getRuntime().Exec()
- “Failed to load resource: net::ERR_FILE_NOT_FOUND” error. The project created by vue-cli 3.0 can run under dev, and an error is reported after packaging, and the page is blank.
- How to Block a frame with origin from accessing a cross origin frame
- Special JSON array of special bracket
- How to Set Time Zone in Golang
- Vue: How to Fix “not displaying the holder in IE9 and below”
- TypeScript error TS2345: Argument of type ‘String ‘is not assignable to parameter of type ‘string’
- How to solve Uncaught (in promise) error in VUE?
- JS native implementation Promise.all
- Localstorage sets the expiration time.
- Method of adding operation button for each line of data in DataGrid of easyUI
- [ERR_INVALID_ARG_TYPE]: The “path“ argument must be of type string. Received undefined error