【发布时间】:2014-12-10 11:21:25
【问题描述】:
// make AJAX call to get contents and display in DIV1 and DIV2
function ajaxRequest(div_id1, div_id2, request_url, request_params) {
$("#" + div_id1).html('<img src="images/loading.gif" alt="Loading" title="Loading"/>');
$.ajax({
type: "POST",
dataType: "html",
url: request_url,
data: request_params,
success: function (response) {
$("#" + div_id1).html('<br>' + response.substring(0, 1);
$("#" + div_id2).html(response.substring(1, 2);
},
error: function (req, errorMsg) {}
})
}
【问题讨论】:
-
问题是什么
-
您的
html方法缺少右括号。 -
html(response.substring(1, 2)
-
只需检查 ajax 成功回调中的右括号。