SHARE
TWEET

Untitled

a guest Jul 17th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. handleSubmit(event) {
  2. event.preventDefault();
  3. //other code before
  4. let json=JSON.stringify(data);
  5. let post_data={json_data:json}
  6.  
  7.  this.grabData(post_data)
  8.   .then((response) => {
  9.     console.log(response)
  10.     var myObj = JSON.parse(response.data.json_data);
  11.     console.log(myObj.length)
  12.     var i;
  13.     for (i = 0; i < 12; i++) {
  14.       console.log("element " + i + " is: " + myObj[i])
  15.     }
  16.     this.state.urls = myObj;
  17.     var z;
  18.     for (z = 0; z < 12; z++) {
  19.       if (this.state.urls[z] === "test") {
  20.         this.state.urls.splice(z, 1);
  21.         z = z - 1;
  22.       }
  23.     }
  24.     console.log("After splicing: " + this.state.urls)
  25.   });
  26. }
  27.  
  28. grabData(post_data) {
  29.   return axios.post('/getCharts', post_data)
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top