title: Uncaught SyntaxError: Illegal break statement
body: <p>I am getting error </p>
  
  <blockquote>
    <p>Uncaught SyntaxError: Illegal break statement</p>
  </blockquote>
  
  <p>on <code>break;</code>, i am want to stop <code>for</code> loop if server return 5. I am using below code:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function getrblstatus(rbl, hash) {
          var rblhosts = [&lt;?php echo $rblhosts ?&gt;];
          var ActiveRbls = rblhosts.length;
          var progress = '1';
          for (i = 0; i &lt; ActiveRbls; i++) {
              ///// Post data to server /////
              $.ajax({
                  url: '&lt;?php echo $site_url?&gt;/includes/lib/ajax.php',
                  data: {
                      action: 'getrblstatus',
                      for: rbl,
                      hash: hash,
                      rbl_host: rblhosts[i]
                  },
                  type: 'post',
                  success: function (data) {
                      var percent = (progress/ActiveRbls)*100;
                      percent = percent.toFixed(2);
                      if(data == 5) {
                          console.log('Hash not correct');
                          break;
                      }
                      else{
                          $('#rbl_table &gt; tbody').append(data);
                          $('#progressbar').width(percent+'%');
                          $("#progressbar").html(percent+"% Completed");
                          progress ++;
                          continue;
                      }
                  }
              });
          }
      }
  &lt;/script&gt;
  </code></pre>