Sending HTML Code Through JSON

前端 未结 7 1062
暗喜
暗喜 2020-11-30 07:07

I\'ve got a php script which generates HTML content. Is there a way to send back that HTML content through JSON to my webpage from the php script?

相关标签:
7条回答
  • 2020-11-30 08:12

    Do Like this

    1st put all your HTML content to array, then do json_encode

    $html_content="<p>hello this is sample text";
    $json_array=array(
    
    'content'=>50,
    'html_content'=>$html_content
    );
    echo json_encode($json_array);
    
    0 讨论(0)
提交回复
热议问题