title: How to call another fetch after the response has come from previous fetch call in Javascript?
body: <p>There are two fetch statements and I want to execute the second one only after the response has come from the first one -> </p>
  
  <pre><code>    function CreateRide(userId){
      const baseUrl = "138.197.99.29:7000/createRide";
      var reqObj = {};
      var responseObj = {"success":false};
      let url = 'http://138.197.99.29:7000/createRide?lat=122.254&amp;lng=14.144&amp;vehicleID=vufn414&amp;time=test';
      fetch(url)
          .then((resp) =&gt; resp.json())
          .then(function (data) {
              responseObj.success = true;
              console.log(data.rideID);
              return data.rideID;
          })
      .catch(function (error) {
  
              responseObj.success = false;
              console.log(error)
          })
  }
  </code></pre>
  
  <p>and -> </p>
  
  <pre><code>function StartRide(rideId){
      const baseUrl = "138.197.99.29:7000/createRide";
      var reqObj = {};
      var responseObj = {"success":false};
      let url = 'http://138.197.99.29:7000/startRide?rideID=' + rideId;
      fetch(url)
          .then((resp) =&gt; resp.json())
          .then(function (data) {
              responseObj.success = true;
              console.log(data);
              return data.success;
          })
          .catch(function (error) {
              responseObj.success = false;
              console.log(error)
          })
  }
  </code></pre>
  
  <p>and I want to execute StartRide after the response has come from CreateRide</p>