我正在尝试根据从服务器收到的 JSON 响应追加到有序列表。响应包含 HTML 标签,由于某种原因,它们没有以 HTML 格式呈现。我为响应消息做了一个 console.log,它看起来没问题。但是,当我将其附加到我的列表时,它不会显示在屏幕上。
我在后端使用带有 jquery 和 PHP/Mysql 的 ajax 调用。
这里是 jquery 代码片段:
success: function (response) {
var responsedata = jQuery.parseJSON(response);
console.log(responsedata.msg);
$('#step3ul2').append("<li>"+responsedata.msg+"</li>");
$("#finalmsgsuccessdiv").show();
},
console.log 打印:
<a href = '../editrequest/index.php?q=88>Request id 88</a> was successfully added in the system
但是浏览器什么也没显示。
最佳答案
会不会是'a'标签上的href属性没有单引号闭合?
<a href = '../editrequest/index.php?q=88>
对比
<a href = '../editrequest/index.php?q=88'>
关于php - Jquery 无法附加到以 HTML 作为内容的有序列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8813684/