Fetch disables all JS functions.

Asked 2 years ago, Updated 2 years ago, 18 views

testLoad For some reason, if the function of JS is not defined, the behavior will be strange.
What should I do?

stacker?id=9:205 Uncaught ReferenceError: formationFunction is not defined
at HTMLInputElement.onclick (stackover?id=9:205)

function testLoad(){
        responseData={};
        let myFetch=fetch(url);
        
        myFetch.then(response=>response.json()) .then(
            clearDataElementList();
                responseData=>{
                        var param="&cost=100";
                        varurl="http://..."+param;
                        createLink(url)
                        }
                
                    console.log(responseData);
        )
    }

    function formationFunction() {
        var selectDate= document.getElementById('select');
       // Processing
    }

javascript

2022-09-29 22:18

1 Answers

myFetch.then(response=>response.json()) .then(
            clearDataElementList();
                responseData=>{...}
                    console.log(responseData);
        )

This is where the grammar error appears and the subsequent code is disabled.

then() The parameters that you can specify for the function are 式expression 」 such that the value becomes a function.This code contains the following grammatical errors: clearDataElementList(); and responseData=>{...} and console.log(...); .


2022-09-29 22:18

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.