AJAX返回读取php函数

时间:2018-12-15 14:41:45

标签: javascript php ajax

im试图回应ajax的结果;

我的php代码是

if(isset($_POST['date']) )
{
    echo "<input type='radio' id='date'/>";
}

和我的Ajax代码:

$.ajax(
{
    type: "POST",
    url: "schedule.php",
    data: {date:  dateAsString},
    success: function(result) 
    {
        $('#res').text(result); 
        // i know this is .text that's why printing text instead of html input. 
        // i don't know what line of code to execute my php into html command
    } 
});

如何用html语言回显php代码行以打印输入

1 个答案:

答案 0 :(得分:0)

更改

$('#res').text(result);

$('#res').html(result);