ajax传值到后台,这样写直接输出data error;
data: "{'s':'" + selectedText + "'}",没办法传带单引号的
data: "{ \"s\":\""+ selectedText+"\" }",没办法传带双引号的
function ajaxSend() {
jQuery.blockUI({ message: "处理中,请稍候...<img src='阅读_files/content/images/加载-007.gif' />", css: { color: 'black', border: '3px solid #aaa', backgroundColor: 'white' }, overlayCSS: { opacity: '0.0' } });
alert("解析过程需要10秒,如有卡顿,请稍等");
$.ajax({
type: "Post",
url: "Reader.aspx/GetStr",
async: false,
//data: "{'s':'" + selectedText + "'}",
data: { s: selectedText },
//data: "{ \"s\":\""+ selectedText+"\" }",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
$('#Report').html(data.d);
jQuery.unblockUI();
$('html,body').animate({ scrollTop: document.body.clientHeight + 'px' });//跳转至页面最底部
},
error: function (err) {
alert("data error");
jQuery.unblockUI();
}
});
}