title: For loop is not working properly in javascript with PHP
body: <p>I am working with php and ajax,I am getting ajax response( as [&quot;463&quot;,&quot;500&quot;,&quot;505&quot;] ) and i am trying to pass this via loop but loop is working only single time instead of three
  Here is my code,Where i am wrong ?</p>
  <pre><code>$.ajax({
      type: &quot;post&quot;,
      url:'&lt;?php echo base_url();?&gt;Main/GetFollowingCoinUsers',
      data: {coin_id:coin_id},
      success: function (datan) {
          //datan contaning values like - [&quot;463&quot;,&quot;500&quot;,&quot;505&quot;]
          var str_array = datan.split(',');
          var conn = new WebSocket('ws://localhost:8282');
          var client = {
              user_id: &lt;?php echo $number; ?&gt;,
              recipient_id: null,
              NotificationType: 'notification',
              type: 'socket',
              token: null,
              message: null
          };
  
          conn.onopen = function (e) {
              conn.send(JSON.stringify(client));
          };
              
          for (var i=0; i &lt; str_array.length; i++) {
              client.message = 'notifications';
              client.token = '';
              client.type = 'chat';
              client.recipient_id = str_array[i].send(str_array.toString());
              conn.send(JSON.stringify(client));  
          }
      }
  });
  </code></pre>