【发布时间】:2017-12-01 15:21:04
【问题描述】:
我有一个 GET ajax 调用如下:
var changeUrl = "changePriority?newValue=" + targetValue + "&justification=" + justification
if (dataInfo == "row") {
changeUrl += "&id=" + id
}
changeUrl += "&executedConfigId=" + executedConfigId + "&currUser=" + currentUser + "&productName=" + productName + "&eventName=" + eventName + "&alertDetails=" + JSON.stringify(alertArray);
//if the selected signal is not null then we show the product names
$.ajax({
url: changeUrl,
type: "GET",
success: function (data) {
for (var index = 0; index < checkedRowList.length; index++) {
var row = checkedRowList[index]
signal.list_utils.change_priority(row, targetValue);
}
$('#change-priority-modal').modal('hide');
if (applicationName == "Signal Management") {
signal.list_utils.set_value(parent_row, 'dueIn', id, signal.list_utils.get_due_in, applicationName);
$(parentField).html(targetValue);
}
location.reload();
},
error: function (exception) {
console.log(exception);
}
});
我在浏览器的开发者控制台中得到的changeUrl 的值是:
http://localhost:8080/signal/singleCaseAlert/changePriority?newValue=Medium&justification=test%20justification%20first.&id=6816&executedConfigId=6704&currUser=15&productName=Wonder%20Product&eventName=1.Pyrexia&alertDetails=[{%22alertId%22:%226816%22,%22event%22:%221.Pyrexia%22,%22currentUser%22:%2215%22}]
但我在后端收到 400 错误请求状态和 http 标头解析错误。有人可以帮我解决这个问题吗?
【问题讨论】:
-
将
;放在第一行的末尾以及第三行 -
首先检查错误日志以找出为什么您得到 400。
-
@YashParekh 输入分号没有帮助。
-
@CBroe 我已经尝试解析 url 它正确地提供了所有查询字符串参数。
标签: javascript ajax http url