title: Regarding the iteration query in node.js with mysql
body: <p>After the update request is sent, I would like to get a success/fail response.</p>
  
  <p>Regarding the response, I have to receive the one response <strong>after all update query is performed.</strong></p>
  
  <p>How to receive the one response?</p>
  
  <p>The following code is my node.js server example.</p>
  
  <p>Thank you!!</p>
  
  <pre><code>$.ajax({
       url: "http://127.0.0.1:62590/updatingResourceList",
      type: "put",
      dataType: "text",
      cache: false,
      timeout: 30000,
      data: JSON.stringify(jsonObject),
      contentType: "application/json",
  
      success: function (data) {
          alert("Success updating the resource");
      }, error: function (xhr, textStatus, errorThrown) {
          alert(textStatus + ' : ' + errorThrown);
      }
  });
  </code></pre>
  
  <p>=========================================================================</p>
  
  <pre><code>app.put('/updatingResourceList', function (request, response) {
  
      var resultObj = request.body;
      var updatedIDList = resultObj['idList'];
  
      // Updating the user request format
      var idCounting = 0;
  
      for(var i = 0; i &lt; updatedIDList.length; i++) {
  
          var latest = timestamp();
          var resourceName = updatedIDList[i];
          var client = dbClient.getDBClient(); // Getting Database information.
  
          client.query('UPDATE testset SET time=? WHERE resourceName=?', [latest, resourceName], function (error, results, fields) {
              if (error) { // error
                  console.log("MySQL : Database resource update error : " + error);
                  response.status(500).end();
              } else { // success
                  console.log('MySQL : Success updating the resource : ' + resourceName);
                  response.status(200).end();
              }
          });
      }
  });
  </code></pre>