Tag Archives: js

JS Unexpected syntax error: unexpected string

JS error, finally found that the $(function () {}) part () is incomplete

$(function({
        $("#directionSelect").change(function(){
         
            $.ajax({
                url:"",
                success:function(data){
                    if(data.state=="fail"){
                        alert("The system is busy, please try again later!");
                    }else{
                     
                    }
                }
            });
        });
    });

After summarizing the previous errors, it is found that most of the errors are incomplete symbols, such as missing a bracket or a quotation mark

Solve Google browser JS error: uncaught (in promise) domexception

In the address bar of chrome, enter: chrome://flags/#autoplay -Policy enter to open the setting page. On the setting page, you will see the font marked with yellow box: autoplay policy. This option is set to default by default and changed to no user heritage is required. After modifying the option, a prompt box will pop up at the bottom of the page, Click “relaunch now” on the prompt box

Using Vue + Axios: axios.post error: request failed with status code 400 is one of the solutions

When doing company exercises, use Vue to add, delete, modify and query. When data modification is requested in the background:

Axios.post Error: Request failed with status code 400

This representation has been requested to the server, but there is a problem when parsing the data. Let’s first check the specific problem in the browser’s network option (the background compiler did not report an error).

The problem of data analysis is:

“Failed to convert property value of type ‘java.lang.String’ to required type ‘java.util.Date’ for property ‘datetime’;

You can find that the format of the date in the foreground is string, and the corresponding date format in the background is date. So the data format is not correct when parsing the background data.

Solutions:

In the foreground, data of character type can be converted to date format–

Datetime — is the format data of a string

Date — converts date data in string format to date format.

The background date data format is: date

When the data consistency between the foreground and background is solved, the 400 error will be eliminated.

Conclusion:

(1) When we have 400, 405, 4xx series problems in the front console. You can directly see the corresponding problems on the console. Then find out the corresponding method according to the specific problem.

(2) 4xx series of problems should be the front to the background data response problems. We need to be familiar with the corresponding steps and principles of Ajax, Axios and other asynchronous requests in order to quickly find out the problem.

Axios Chinese parsing document:

https://www.kancloud.cn/luponu/axios