gpt4 book ai didi

javascript - jQuery AJAX : Uncaught SyntaxError: Unexpected token

转载 作者:行者123 更新时间:2023-12-03 05:08:17 26 4
gpt4 key购买 nike

当用户使用搜索文本框时,我尝试用新内容更新我的div内容:

$('#business_request_filter_search_textbox').on('input propertychange paste', function () {
$.ajax({
url: "/ajax/housekeeping/business/" + $("#search_filter_selection")[0].selectedIndex == 1 ? "get-requests-by-username" : "get-requests-by-business-name";
type: "GET",
cache: false,
data: { search: $('input#business_request_filter_search_textbox').val() },
beforeSend: function(xhr) {
$('#request_area').html('<center>Please wait while we gather results...</center>');
},
success: function(data) {
$('#request_area').html(data);
},
});
});

现在我有一个下拉菜单,选择他们想要过滤搜索的内容,用户名或公司名称。这是引发错误的行。

url: "/ajax/housekeeping/business/" + $("#search_filter_selection")[0].selectedIndex == 1 ? "get-requests-by-username" : "get-requests-by-business-name";

我做错了什么吗?

最佳答案

url 行末尾应该有一个逗号“,”:

$('#business_request_filter_search_textbox').on('input propertychange paste', function () {
$.ajax({
url: "/ajax/housekeeping/business/" + $("#search_filter_selection")[0].selectedIndex == 1 ? "get-requests-by-username" : "get-requests-by-business-name",
type: "GET",
cache: false,
data: { search: $('input#business_request_filter_search_textbox').val() },
beforeSend: function(xhr) {
$('#request_area').html('<center>Please wait while we gather results...</center>');
},
success: function(data) {
$('#request_area').html(data);
},
});
});

关于javascript - jQuery AJAX : Uncaught SyntaxError: Unexpected token,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41936052/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com