1

Bootstrap model shows same content, when fetching data using jplist with php, sql.

Example Link

Source Files

Link tried

        private function getHTML($item){

        $html = "";

        $html .= "<div class='list-item box'>"; 
        $html .= "  <div class='img left'>";
        $html .= "      <img src='" . $item['image'] . "' alt='' title=''/>";
        $html .= "  </div>";

        $html .= "<div class='dropdown'>";
        $html .= "<button class='btn btn-primary btn-xs dropdown-toggle' type='button' id='dropdownMenu1' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>Details</button>";
        $html .= "<ul class='dropdown-menu' aria-labelledby='dropdownMenu1'>";
        $html .= "<p class='title'>" . $item['title'] . "</p>";
        $html .= "<p class='likes'>" . $item['likes'] . "</p>";
        $html .= "</ul>";
        $html .= "</div>";

        $html .= "<button type='button' class='btn btn-primary btn-lg' data-toggle='modal' data-target='#myModal'>Launch demo modal</button>";
        $html .= "<div class='modal fade' id='myModal' tabindex='-1' role='dialog' aria-labelledby='myModalLabel'>";
        $html .= "<div class='modal-dialog' role='document'>";
        $html .= "<div class='modal-content'>";
        $html .= "<div class='modal-header'>";
        $html .= "<h4 class='modal-title' id='myModalLabel'>Modal title</h4>";
        $html .= "<p class='title'>" . $item['title'] . "</p>";
        $html .= "<p class='likes'>" . $item['likes'] . "</p>";
        $html .= "</div>";
        $html .= "</div>";
        $html .= "</div>";
        $html .= "</div>";


        $html .= "  <div class='block right'>";
        $html .= "      <p class='title'>" . $item['title'] . "</p>";
        $html .= "      <p class='desc'>" . $item['description'] . "</p>";
        $html .= "      <p class='like'>" . $item['likes'] . " Likes</p>";
        $html .= "      <p class='theme'>" . $item['keyword1'] . ", " . $item['keyword2'] . "</p>";
        $html .= "  </div>";
        $html .= "</div>";

        return $html;
    }

It stores the clicked link in the modal's data, i dont't know how to get new data or remove the old one before fetching.

vats111
  • 11
  • 1
  • modal should be 1 not like each button has separate modal with same `id` and you are running a loop so imagine 10 modals on each page remove your modal code inside the loop and put it outside the loop and then try – Shehary Sep 04 '15 at 15:56
  • I had tried ,but not achieved any results, can you please tell me where to put the code ? – vats111 Sep 06 '15 at 10:55

0 Answers0