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.
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?
PHP file:
    echo "<button method='post' class='btn view' name='view' data-toggle='modal' href='.myModal' value='$a' >View Images</button>"; 
/*  some code*/
<div class='myModal'>
/*some code to display images of a folder in a carousel, the folder name of which is in data of ajax call*/
</div>
AJAX call:
$(".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;
 });