title: Foreach-loop for Array, which got via AJAX-query
body: <p>I have the JS-code:</p>
  
  <pre><code>$("#select_bank").change(function () {
    selected_bank = $("#select_bank option:selected").text();
  
    $.ajax({
      type: 'POST',
      dataType: 'html',
      data: {
        selectedBank: selected_bank
      },
      url: '&lt;?= base_url() . 'atm/select_region'; ?&gt;',
      success: function (list_regions) {
        foreach(keyVar in list_regions) {
          alert(list_regions[keyVar]);
        }
      }
    });
  });
  </code></pre>
  
  <p>On callback "succes"s I get the array from server's script - in alert I see the "Array" - so I want to iterate via this array on client-side like I coded above, but when doing I get the error in console - "var keyVar is not defined". As I understand I need to typecast the <code>list_regions</code> param as array or some another way to fix it. Please, how to make it better?
  Thanks!</p>
  
  <p>upd: <img src="https://i.stack.imgur.com/gExUV.jpg" alt="enter image description here"></p>