我在问这个问题,你如何用PHP+MySQL+jQuery开发这样的东西,而这个地址是用ASP完成的(图10):http://msdn.microsoft.com/en-us/magazine/dd722809.aspx#id0400013
当我点击首页中的消息链接时,我想让MySQL表数据打印在jQuery UI对话框弹出窗口上。我可以让它打印HTML表标题之类的,但根本没有MySQL表数据。
这就是没有jQuery(它是一个公告板系统)的情况下头版的工作方式:
$sql="SELECT *
FROM message, user
WHERE message.userID = user.userID
ORDER BY messageID DESC";
$result=mysql_query($sql);
打开新页面的消息标题中的链接:
<a href="message.php?id=<?php echo $rows['messageID']; ?>">
这是一条消息的"所有字段"页面上的代码:
$id=$_GET['id'];
$sql="SELECT *
FROM message, user
WHERE message.userID = user.userID AND messageID='$id'";
$result=mysql_query($sql);`
以下是如何使用AJAX将内容加载到jQuery Dialog 中的示例
HTML
<a class="loadextradata" href="message.php?id=<?php echo $rows['messageID']; ?>">
JavaScript
$('.loadextradata').on('click', function() {
var url = this.href; // get the url from the anchor
var dialog = $("#dialog"); // get DOM element
if ($("#dialog").length == 0) { // if it doesnt exist create it
dialog = $('<div id="dialog" style="display:hidden"></div>').appendTo('body');
}
// load remote content
dialog.load(
url, // to the url from the anchor href attribute
{},
function(responseText, textStatus, XMLHttpRequest) { // success callback
dialog.dialog(); // show the dialog
}
);
return false; // prevent the default action on the anchor
});
message.php
需要发送您想要在对话框中显示的HTML。要进行内联编辑,需要将表单提交给另一个PHP。