discuz手机版发帖提示“网络出现问题,请稍后再试”

大家好,我是网创有方。今天分享一个discuz发帖报错的问题。

问题描述:discuz手机网页端发帖提示"网络出现问题,请稍后再试",但是实际上帖子已经发布成功。

本次记录下分析过程:

第一步:打开宝塔,找到站点文件,通过提示词搜索对应文件,查看相应代码。

复制代码
var myform = document.getElementById('postform');
var formdata = new FormData(myform);
$.ajax({
type:'POST',

url:form.attr('action') + '&geoloc=' + postlocation + '&handlekey='+form.attr('id')+'&inajax=1',
data:formdata,
cache:false,
contentType:false,
processData:false,
dataType:'xml'
})
.success(function(s) {
popup.open(s.lastChild.firstChild.nodeValue);
})
<!--.error(function() {-->
<!--popup.open('网络出现问题,请稍后再试', 'alert');-->
<!--});-->
.error(function(xhr, status, error) {  
    console.error('AJAX请求失败:', status, error);  
    console.error('HTTP状态码:', xhr.status);  
    console.error('响应文本:', xhr.responseText);  
    popup.open('网络出现问题,请稍后再试'+'status状态:'+status+'xhr.status状态:'+xhr.status+'响应文本:'+xhr.responseText, 'alert');  
});

return false;
});
$(document).on('click', '.del', function() {
var obj = $(this);
$.ajax({
type:'GET',
url:'forum.php?mod=ajax&action=deleteattach&inajax=yes&aids[]=' + obj.attr('aid') + (obj.attr('up') == 1 ? '&tid=<?php echo $postinfo['tid'];?>&pid=<?php echo $postinfo['pid'];?>&formhash=<?php echo FORMHASH;?>' : ''),
})
.success(function(s) {
obj.closest('li').remove();
})
<!--.error(function() {-->
<!--popup.open('网络出现问题,请稍后再试', 'alert');-->
<!--});-->
.error(function(xhr, status, error) {  
    console.error('AJAX请求失败:', status, error);  
    console.error('HTTP状态码:', xhr.status);  
    console.error('响应文本:', xhr.responseText);  
    popup.open('网络出现问题,请稍后再试'+'status状态:'+status+'xhr.status状态:'+xhr.status+'响应文本:'+xhr.responseText, 'alert');  
});

发现提示语存在于ajax网络失败请求回调中,但是光看它提示的log,发现不出来问题。

于是在2处提示的地方添加了下面的调试代码,并且注释掉了原代码。

复制代码
.error(function(xhr, status, error) {  
    console.error('AJAX请求失败:', status, error);  
    console.error('HTTP状态码:', xhr.status);  
    console.error('响应文本:', xhr.responseText);  
    popup.open('网络出现问题,请稍后再试'+'status状态:'+status+'xhr.status状态:'+xhr.status+'响应文本:'+xhr.responseText, 'alert');  
});

第二步:关闭相应插件

在重新发帖后,提示报错来源于一个叫做西山SEO的插件。到管理中心关闭插件后重新发帖成功。

相关推荐
你觉得脆皮鸡好吃吗5 天前
XSS渗透 COOKIE
网络·http·okhttp·网络安全学习
彭于晏Yan8 天前
OkHttp 与 RestTemplate 技术选型对比
java·spring boot·后端·okhttp
JohnnyDeng948 天前
OkHttp 拦截器链与缓存策略:深度解析网络层的核心机制
okhttp·缓存
胖胖胖胖胖虎9 天前
okhttp Stream Load 含认证请求重定向
starrocks·okhttp
步十人9 天前
【JavaScript】通过AJAX技术让前端发请求到后端
javascript·ajax·okhttp
XiYang-DING9 天前
【Spring】 Ajax
spring·ajax·okhttp
hj104310 天前
fastadmin 开发示例:使用 layer 弹窗实现数据快速录入
okhttp
YF021114 天前
Android App 高效升级指南:OkDownload 多线程断点续传与全版本安装适配
android·okhttp·app
YF021116 天前
深度解构Android OkDownload断点续传
android·数据库·okhttp
右耳朵猫AI19 天前
Python技术周刊 2026年第14周
开发语言·python·okhttp