输出缓冲、php页面和ajax
我有一个php页面,我想用ajax获取输出的html。这是我的ajax代码输出缓冲、php页面和ajax,php,jquery,Php,Jquery,我有一个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 c
<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>
这是否会将php页面输出的html内容返回到ajax?可能。你试过了吗?
echo$html代码>而不是.echo?我必须将其返回到ajax函数。
ob_start(); // begin buffering content
/* php page content */
$html = ob_get_clean(); // grab buffered content and stop buffering
return $html;