这是我的示例 json 数据
{"Caption":"BBA Feedback Form ","Notes":"Fields marked with \u003cfont size=\"-2\" color=\"#e30102\" face=\"Verdana\"\u003e (*) \u003c/font\u003e are compulsory","Name":"Name\u003cfont size=\"-2\" color=\"#e30102\" face=\"Verdana\"\u003e * \u003c/font\u003e","Subject":"Subject\u003cfont size=\"-2\" color=\"#e30102\" face=\"Verdana\"\u003e * \u003c/font\u003e","Email":"Email Address\u003cfont size=\"-2\" color=\"#e30102\" face=\"Verdana\"\u003e * \u003c/font\u003e","Details":"Feedback\u003cfont size=\"-2\" color=\"#e30102\" face=\"Verdana\"\u003e& nbsp;* \u003c/font\u003e"}
我想用 jquery 解析它并填写我的标签。我在下面尝试过这样的方法,但没有奏效。
function LoadEnquiryData() {
$.ajax({
type: "POST",
url: urlToHandler + "?ac=show",
data: {},
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
$("input[id*='enq_lblcaption']").val(data["Caption"])
$("input[id*='enq_lblnotes']").val(data["Notes"])
$("input[id*='enq_lblfield_name']").val(data["Name"])
$("input[id*='enq_lblfield_subject']").val(data["Subject"])
$("input[id*='enq_lblfield_email']").val(data["Email"])
$("input[id*='txtEnqDetails']").val(data["Details"])
$("input[id*='btnEnqSubmit']").val(data["SubmitVal"])
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(textStatus);
}
});
}
所以请指导我如何解析它。谢谢