title: Print Json data into html format
body: <p>I posted the image in an array from my form using <code>AJAX</code>, and in response I received a <code>JSON</code> data</p>
  
  <p>I received the below code in my console as response;</p>
  
  <pre><code>0"C:\xampp\htdocs\3Dklik\..../1492427792slider_7.jpg"
  1"C:\xampp\htdocs\3Dklik\mog/1492427792slider_2.jpg"
  2"C:\xampp\htdocs\3Dklik\mo…../public/img/1492427792"
  id""
  user_id"1"
  </code></pre>
  
  <p>The following is my <code>AJAX</code> code:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $(document).ready(function(e) {
          $("#btnsubmit").on('click', function(e) {
              e.preventDefault();
              var formData = $('#uploadform').serialize();
              var files = $("#uploadform")[0];
              console.log(files);
              $.ajax({
                  url: '&lt;?php echo $this-&gt;url('
                  upload ');?&gt;',
                  type: 'POST',
                  data: new FormData(files),
                  xhr: function() {
                      var myXhr = $.ajaxSettings.xhr();
                      return myXhr;
                  },
                  success: function(data) {
                      alert("Data Uploaded: " + data);
                      console.log(data);
                  },
                  error: function(result) {
                      alert("Error");
                  },
  
                  cache: false,
                  contentType: false,
                  processData: false
              });
              return false;
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>And the following is my <code>PHP</code> code;</p>
  
  <pre><code>public function uploadAction() {
      $request = $this - &gt; getRequest();
      if ($request - &gt; isPost()) {
          $data = array_merge_recursive(
              $request - &gt; getPost() - &gt; toArray(),
              $request - &gt; getFiles() - &gt; toArray()
          );
          // echo'&lt;pre&gt;';print_r($data); 
      }
      $image_array = array_slice($data, 2);
      //print_r($image_array); 
      foreach($image_array as $files) {
          //print_r($files); 
          $file_new_name = round(microtime(true)).$files['name'];
          $destination = "public/img/".$file_new_name;
          $file_name = $files['tmp_name'];
          move_uploaded_file($file_name, $destination);
          $data[] = __DIR__.('/../../../../../public/img/').$file_new_name;
      }
      return new JsonModel(array(
          'data' =&gt; $data
      ));
  }
  </code></pre>
  
  <p>Basically the <code>JSON</code> data includes the image path, but I wish to display the image in my <code>&lt;div&gt;</code>. How can I achieve this?</p>