我有这个ajax:
$.ajax({
method: "GET",
url: $('.item').data('query_selector'),
dataType: "html"
(它工作正常,它回调了类似"item=Mann+Co.+Supply+Crate&quality=6&tradable=1&craftable=1&numeric=crate&comparison=eq&value=47&australium=-1"
)
现在,为了有效,它必须是"/classifieds?(query_selector)"
(所以在上面的例子中,"/classidieds?item=Mann+Co.+Supply+Crate&quality=6&tradable=1&craftable=1&numeric=crate&comparison=eq&value=47&australium=-1"
)
我该怎么做?
答案 0 :(得分:0)
将url字符串放在ajax
之外var requestString = '/classifieds?' + $('.item').data('query_selector');
$.ajax({
method: "GET",
url: requestString,
dataType: "html"
});