I am trying to show the data from database in a HTML Table and I want to show this html table inside the alert box when the td
is double clicked, now its showing the data in side the alert box when the td
is double clicked, but not displaying like html table (note: now it displaying data s in alert box but not as html format), below is my code.
Ajax
$('td').dblclick(function() {
$.ajax({ //create an ajax request to load_page.php
type: "GET",
url: "supplierprice/retrieve.php",
dataType: "html", //expect html to be returned
success: function(response){
$("#responsecontainer").html(response);
alert(response);
}
});
});
HTML
echo ' <td id="alertShow" width="114px;" class="edit region '.$rows["supp_price_id"].'">'.$rows["region"].'</td>
<td id="alertShow" width="115px;" class="edit country '.$rows["supp_price_id"].'">'.$rows["country"].'</td>
<td id="alertShow" width="286px;" class="edit networkname '.$rows["supp_price_id"].'">'.$rows["networkname"].'</td>
<td id="alertShow" width="92px;" class="edit mcc '.$rows["supp_price_id"].'">'.$rows["mcc"].'</td>
<td id="alertShow" width="94px;" class="edit mnc '.$rows["supp_price_id"].'">'.$rows["mnc"].'</td>
<td id="alertShow" width="92px;" class="edit mnp '.$rows["supp_price_id"].'">'.$rows["mnp"].'</td>';
retrieve.php :
include"config.php";
$result=mysql_query("select * from supplierpricehistory");
echo "<table border='1' >
<tr>
<td align=center> <b>supplier</b></td>
<td align=center><b>country</b></td>
<td align=center><b>networkname</b></td>
<td align=center><b>mcc</b></td></td>
<td align=center><b>mnc</b></td>
<td align=center><b>newprice</b></td>
<td align=center><b>oldprice</b></td>
<td align=center><b>status</b></td>
<td align=center><b>date</b></td>
<td align=center><b>user</b></td>";
while($data = mysql_fetch_row($result))
{
echo "<tr>";
echo "<td align=center>$data[1]</td>";
echo "<td align=center>$data[2]</td>";
echo "<td align=center>$data[3]</td>";
echo "<td align=center>$data[4]</td>";
echo "<td align=center>$data[5]</td>";
echo "<td align=center>$data[6]</td>";
echo "<td align=center>$data[7]</td>";
echo "<td align=center>$data[8]</td>";
echo "<td align=center>$data[9]</td>";
echo "<td align=center>$data[10]</td>";
echo "</tr>";
}
echo "</table>";
Can anyone guide me how to do this or there is any other way to do it. Thanks
The standard js alert cannot be formatted. You should use custom dialogs for example http://jqueryui.com/dialog/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.