Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

TypeError: JSON.stringify(...).then is not a function

fetch('http://localhost:5000/', {
    method : 'post',
    headers :{ 'Content-Type' : 'application/json'},
    body : JSON.stringify({
         userId : this.state.userId,
         password : this.state.password
   })
}).then(response => response.json())
  .then(data => {
    if(data === 'success'){
            this.props.onRouteChange('home');
    }
})
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #function
ADD COMMENT
Topic
Name
7+5 =