【发布时间】:2016-02-25 06:49:21
【问题描述】:
我正在通过发送 ajax 请求来创建一个 html 代码。
Ajax script
$.ajax({
url: "{{url('/')}}/phpScript", //Server script to process data
type: 'POST',
dataType: 'json',
data: data, //this is an object with all my required variables
success: function (html) {
if (html) {
$('#someTag').html(html); //change the html of #someTag with new html
}
}
});
PHP Script:
static function createHtml() {
ob_start(); ?>
<div class="large-12 medium-12 columns" id="certificate-holder">
<div class="middle-wrappe">
<?php //some other code here to create the html ?>
</div>
<style>/** some style here**/</style>
</div>
<?php return ob_get_clean();
}
This is working fine and I am able to create html and change the html with new html.
有什么方法可以创建该 html 块的图像,以便我可以返回图像并在该 #someTag 而不是 html 中显示图像。
我使用anam/phantommagick从html创建图像,但在此我需要传递页面的url来创建图像。
谢谢
【问题讨论】:
标签: javascript php image laravel-4