title: Display Json array after post - autcomplete
body: <p>Hi I am doing jQuery post to my file where I have curl which has to fetch php array then I am parsing it as JSON when it comes back as succes. </p>
  
  <p>But I cant see it as array inside script tags.
  I need to do Autocomplete on this json array but it doesnt append in the array. Please help, code below. Code as it self works, e.g. but I dont know how to implement autocomplete.</p>
  
  <p>/<em>Here is curl</em>/</p>
  
  <pre><code>if ($_POST['function'] == 'cities')
  {
  ///Cities - WORKING 
  
  $ch = curl_init('URL - works');
  curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_HTTPHEADER, array(
          'Content-Type: application/json',
          'Accept: application/json')
  );
  
  $result = curl_exec($ch);
  print_r($result);
  }
  </code></pre>
  
  <p>AND HERE /*post where I want to have JSON array from which I want to autocomplete */</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
    $.post( "assets/curls.php",{ function: 'cities'}, function( data ) {
  
                  var result = array();
                  result = $.parseJSON(data);
  
        });     
  &lt;/script&gt;
  </code></pre>
  
  <p>What I want to accomplish is to have in result - json array:</p>
  
  <p>result = [city:{New York, Oklahoma, Marakesh}];</p>