简体   繁体   English

使用.htaccess重写后,jQuery无法正常工作

[英]Jquery Not working after Re-writing using .htaccess

I have tried to use .htaccess but my rewriting work fine but note ajax codes there just froze not doing any thin is this because rewriting? 我尝试使用.htaccess,但是我的重写工作正常,但是请注意,那里的ajax代码只是冻结了,不做任何精简操作是因为重写了吗?

MY .Htaccess Code 我的.Htaccess代码

#Turn Rewriter on
RewriteEngine on



RewriteRule ^testthis test/test.php [Nc,L] 

My Php Code 我的密码

<!DOCTYPE html>
<html>
<head>
    <title>THaalinda</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>    
</head>
<body>

Testing 


<script src='testthis/content/test.js' type="text/javascript">


</script>
</body>
</html>

My Jquery Separate file 我的jQuery单独文件

$(document).ready(function(){
    alert('Thaalinda');
})

in here test.js located at (./content/test.js/) before re-Writing it's working perfectly after that it's not working at all 在此处重新写入之前,位于(./content/test.js/)的test.js完全正常工作,之后根本无法正常工作

You need to use absolute path in your url of ajax instead of relative path. 您需要在ajax的URL中使用绝对路径,而不是相对路径。 Change this var link = "./content/php/updatequantity.php?quan="+value+"&id="+updateId; 更改此var链接=“ ./content/php/updatequantity.php?quan="+value+"&id="+updateId; to var link = "/content/php/updatequantity.php?quan="+value+"&id="+updateId; 到var link =“ /content/php/updatequantity.php?quan="+value+"&id="+updateId;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM