javascript - Printing into a pop-up, instead on main window -


i have function shows articles titles 'articles' database.

function show() {     database();      $sql = "select title `articles`";      $titlesql = mysql_query( $sql ) or die("could not select articles:");      $html = '<html><body><div class="container"><h2>basic list group</h2><ul class="list-group">';      while ($title = mysql_fetch_array($titlesql)) {         $html .= '<li class="list-group-item">'.$title["title"].'</li>';     }      $html .= '</ul></div></body></html>';      echo $html; //  die("functie terminata cu succes! :)");  //   die(json_encode(array("mesaj" => "entered data ")));  } 

this function in javascript.

function show()     {         var n = $('#show').val()         $.post("functions.php", {show:n}).done(function(mesaj){             alert(mesaj);         });     } 

problem: because of alert(mesaj), shows string $html pop-up, not on main window, wish! how can modify functions articles list show on m window?

you have give container id set data. bellow put in document.

function show()     {         var n = $('#show').val()         $.post("functions.php", {show:n}).done(function(mesaj){             $(document).html(mesaj);         });     } 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -