title: php display all the images of a folder in a carousel
body: <p>I have multiple tables and for each of them there is a button that when clicked should make all the images of a specific folder related to this button title appear in a carousel.</p>
  
  <p>I am able to pass the variable containing the folder name via AJAX but from there I don't know how to pass that value back to the php file and load/reload that div to display the images.
  Any suggestions?</p>
  
  <p>PHP file:</p>
  
  <pre><code>    echo "&lt;button method='post' class='btn view' name='view' data-toggle='modal' href='.myModal' value='$a' &gt;View Images&lt;/button&gt;"; 
  
  /*  some code*/
  
  &lt;div class='myModal'&gt;
  /*some code to display images of a folder in a carousel, the folder name of which is in data of ajax call*/
  &lt;/div&gt;
  </code></pre>
  
  <p>AJAX call:</p>
  
  <pre><code>$(".view").click(function () {
       $.ajax({
        url:"view.php",
        data:{view:$(this).val()},
        type:"POST",
        success:function(data){
          console.log(data);
          if (data!=""){
            alert(data);
          }
        },
        error:function(data){
          alert("Network ERROR");
        }
      })
     return false;
   });
  </code></pre>