title: JSON response at ajax request to JS variables
body: <p>I am trying to upload files with dynamic names and get those dynamic names back.</p>
  
  <p>In detail, I have 2 page <code>form.php</code> and <code>upload.php</code>. When upload button is pressed on <code>form.php</code> then request sent to <code>upload.php</code>, where 2 files (DLpath and PhotoIDPath) are uploaded to server with dynamically names e.g :</p>
  
  <p><strong>DLpath=documents/20161130232311i8hGn0HzJT276415832.png</strong> </p>
  
  <p>And </p>
  
  <p><strong>PhotoIDPath=documents/20161130232311SSRqCyIbKKalock.png</strong>.</p>
  
  <p>It is working fine. Then on <code>upload.php</code>, I am encoding those file names as JSON array <strong>i.e.</strong></p>
  
  <pre><code>$response  = array ('DLpath'=&gt;$Dlpath ,'PhotoIDPath'=&gt;$PhotoIDPath);
  echo json_encode($response);
  </code></pre>
  
  <p>And firebug snapshot is :</p>
  
  <p><a href="https://i.stack.imgur.com/kplvq.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kplvq.jpg" alt="enter image description here"></a></p>
  
  <p>I want to get DLpath in <code>var jsDlpath</code> and PhotoIDPath in <code>var jsPhotoIDPath</code> </p>
  
  <p>And my code ( Not working) to get response is :</p>
  
  <pre><code>complete: function(response) 
      {
      var jsDlpath=response.DLpath;
      var jsPhotoIDPath=response.PhotoIDPath;
  alert(jsDlpath+" - "+jsPhotoIDPath)
  }
  </code></pre>
  
  <p>And alert show : </p>
  
  <blockquote>
    <p>undefined - undefine</p>
  </blockquote>
  
  <p>If you can help me to gwt those values in js variables, I will be very thankful to you.</p>