成功行中的意外标记

  • 本文关键字:意外 成功 php jquery
  • 更新时间 :
  • 英文 :

// 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) {}
    })
}

你忘了再添加 1 个右括号

 $("#" + div_id1).html('<br>' + response.substring(0, 1));
 $("#" + div_id2).html(response.substring(1, 2));

你有一些错别字:

$("#" + div_id1).html('<br>' + response.substring(0, 1)); 
$("#" + div_id2).html(response.substring(1, 2));

添加)关闭.html()

html()后缺少右括号

success: function (response) {
    $("#" + div_id1).html('<br>' + response.substring(0, 1)); 
    //                                                     ^^
    $("#" + div_id2).html(response.substring(1, 2));
    //                                            ^^
},

最新更新