JQuery字符串处理
获取的字符串会多一个d标签,解决方法:
//保存
toolbar.childNodes[19].onclick = function () {
var htmlEdit = window.frames["HtmlEdit"];
var StrHtml = htmlEdit.document.body.innerHTML.toString();
var StrContent1 = "{StrContent:'" + StrHtml + "'}";
$.ajax({
type: "POST",
url: "editor/funContent.aspx/InsertContent",
contentType: "application/json; charset=utf-8",
data: StrContent1,
dataType: "text",
beforeSend: function (XMLHttpRequest) {
},
success: function (data1) {
//方法一:
//var data = eval("(" + data1 + ")");
//alert(data.d);
//方法二:
var a = jQuery.parseJSON(data1);
alert(a.d);
}
});
}