Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

call axios post with an interval

function postForm(){
  var form = new FormData();
  form.append("user_id", user_id);
  axios.post('http://192.168.29.194/expense_calculator/index.php/API/get_all_transaction',form)
    .then((response) => {
      console.log('sss',response.data.data);
      if(response.data.data){
        setData(response.data.data);
      }
  });
}

useEffect(() => {
  const timer = setInterval(() => postForm, 1000);
  return () => clearInterval(timer);
},[]);
 Run code snippet
Comment

PREVIOUS NEXT
Code Example
Javascript :: Next / Sanity SSR client fetch 
Javascript :: react console logs not working 
Javascript :: react_devtools_backend.js:4026 Warning: Cannot update a component (`BrowserRouter`) while rendering a different component (`Login`). 
Javascript :: Captalize all words first letter javascript 
Javascript :: NodeJS Database initialisation 
Javascript :: Calculator for two numbers 
Javascript :: blob to wav javascript 
Javascript :: call the httpclient.get method called 
Javascript :: Inside Fetch Is A Request 
Javascript :: returning the outliers javascript array 
Javascript :: prisma graphql n+1 problem solution 
Javascript :: How to sum to small numbers 
Javascript :: useState intro 
Javascript :: leetcode solution problem 66 plus one 
Javascript :: expact 
Javascript :: angular service await for data 
Javascript :: how to properly make the navbar to be fixed to the top in react.jsx 
Javascript :: add even javascript 
Javascript :: java scrypt 
Javascript :: javascript number reverse 
Javascript :: arguments object 
Javascript :: electron js execute command line 
Javascript :: dictionnary js 
Javascript :: looping object 
Javascript :: ajax get request javascript 
Javascript :: pimcore 
Javascript :: get cos in degree javascript 
Javascript :: javascript Remove Element from Inner Array 
Javascript :: fetch second parameters 
Javascript :: mui on node 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =