我有一个php页面,我想用ajax获取输出的html。这是我的ajax代码。
<script>
$(function() {
$(".load_product_gallery").on("click",function () {
$.ajax({
url: 'product_gallery_popup.php', // The source
cache: false, // Make sure results are not cached
success: function (data) {
$('.product_gallery_popup_container_2').html(data);
}
});
});
});
</script>
data
应该是php页面的输出html。
我的php页面:
ob_start(); // begin buffering content
/* php page content */
$html = ob_get_clean(); // grab buffered content and stop buffering
return $html;
这会将php页面输出的内容以html格式返回给ajax吗?