jquery - 重写url后Ajax jQuery不起作用
问题描述
我有问题为什么这不起作用。我修改 .htaccess 以删除 .php 扩展名
所以这是我的 htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
# To remove trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} /(.*)/$
RewriteRule ^ /%1 [R=301,L]
# To remove .php extension
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\ (.*)\.php [NC]
RewriteRule ^ %1 [R=301,L]
# To check whether the file exists then set it back internally
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^.*$ $0.php [L]
# To redirect /index to root
RewriteCond %{THE_REQUEST} ^.*/index
RewriteRule ^(.*)index.php$ /$1 [R=301,L]
</IfModule>
这是我的ajax代码
function setStatus(response) {
$.ajax({
type:'POST',
url:'status?status',
data:{response:response},
dataType: 'json',
success:function(response){
$('#status').text(response.status);
$('#fight_number').text(response.fight_no);
$('#result').text(response.result);
$('#total_bet').text("Total Bet Points : " + response.total_bet_points);
$('#points').text("Your Points : " + response.user_points);
$('#meron_counter').text(response.m_side);
$('#wala_counter').text(response.w_side);
$('#draw_counter').text(response.d_side);
$('#cancel_counter').text(response.c_side);
$('#ol').text(response.online_count);
var au = $('.audio').attr('id')
if(response.status_now === 500) {
if(response.events === au) {
setAudio(response.chat_type);
}
}
},
error: function(jqXHR, textStatus, errorThrown){
}
});
}
在修改 htaccess 并删除 .php 之前代码工作正常,所以我在 ajax i 中从 status.php?status 更改为 status?status
为什么这不起作用
谢谢你
解决方案
推荐阅读
- python - 等效于 pyspark 中的 scipy curve_fit
- python - pandas 整数的负整数幂是不允许的
- java - Spring Batch FlatFileItemWriter 仅在第二次运行后处理数据
- java - 如何在新线程中投放广告?
- android - 将带有 RecyclerView Holder 的数组传递给 Alertdialog
- powershell - Powershell 模式匹配
- python - 保持重复和非重复元素之间的关系
- android - 在 PeerConnection.IceServer 生成器错误时出现错误:找不到符号方法生成器(字符串)
- sql - 在 DB2 中使用星期几进行聚合
- python - 在gekko非线性回归中处理多维数组的正确方法是什么?