【发布时间】:2020-08-21 10:29:54
【问题描述】:
我的网站有一个使用 AJAX 嵌入的搜索过滤器表单。当我使用简单的 type 参数访问页面时,它会返回内容,但是当我尝试使用 GET 传递其他参数时,它会显示 404。 示例: http://www.website.com/?type=871(显示默认内容) http://www.website.com/?type=871&controller=abc(返回 404)
Jquery Ajax 代码
$.ajax({
type: 'GET',
url: $(this).attr('action') + '?type=871',
data: $(this).serialize(),
success: function (data) {
$('#searchresults').html(data);
}
});
排版代码
mlAjax = PAGE
mlAjax {
typeNum = 871
}
[globalVar = GP:type = 871]
config {
disableAllHeaderCode = 1
xhtml_cleaning = 0
admPanel = 0
debug = 0
no_cache = 1
}
tt_content.list.10 >
// Insert content that can handle the request
mlAjax {
10 = COA
10 {
10 = USER
10 {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
}
}
}
[global]
表单标签
<f:form id="searchform" action="searchResult" method="get" noCacheHash="TRUE">
【问题讨论】:
-
首先,您必须将 GET 方法更改为 POST。其次,您可能需要在配置中添加 extensioName 和 pluginName。 prnt.sc/sbxavz如果它对你有帮助,请告诉我包括作为答案
-
我也尝试过使用 POST。我已经在我的配置中添加了 extensionName 和插件。
标签: ajax typo3 http-status-code-404