Javascript jquery post调用不使用url末尾的斜杠
示例url:Javascript jquery post调用不使用url末尾的斜杠,javascript,php,jquery,.htaccess,Javascript,Php,Jquery,.htaccess,示例url: 目标不是显示.php扩展名,而是当页面/url以斜杠结尾打开时,内容停止工作 -表单正在使用此url -表单无法使用此url 文件夹和文件: | |/js/custom.js |/manager/create.php |/manager/creategetpostdata.php |/manager/.htaccess custom.js上的内容 $(window).load(function() { // get post code data $('.conten
目标不是显示.php扩展名,而是当页面/url以斜杠结尾打开时,内容停止工作
-表单正在使用此url
-表单无法使用此url
文件夹和文件:
|
|/js/custom.js
|/manager/create.php
|/manager/creategetpostdata.php
|/manager/.htaccess
custom.js上的内容
$(window).load(function() {
// get post code data
$('.contentfinder').on('keyup', function(e){
var xyz = $(this).closest('.contentRow');
//alert( "success" );
$.post("../manager/creategetpostdata.php", xyz.find('.contentfinder').serialize(), function(response) {
//alert( "success" );
xyz.children('.showPostData').html(response);
xyz.children('.showPostData').show();
});
});
});
在create.php文件上输入表单:
<div class="contentRow">
<input type="text" name="inputdata" class="form-control contentfinder" placeholder="" />
<div class="showPostData"></div>
</div>
有什么帮助吗?
提前谢谢
| | | | | | | | | | | |
var loc = window.location.pathname;
var dir = loc.substring(0, loc.lastIndexOf('/create'));
$.post( dir + "/creategetpostdata.php", xyz.find('.contentfinder').serialize(), function(response) {
//alert( "success" );
xyz.children('.showPostData').html(response);
xyz.children('.showPostData').show();
});
这可能与此相关:@JeremyThille感谢您的帮助。:)
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteCond %{THE_REQUEST} \s/+(.+?)\.php\?([^=]+)=([^\s&]+) [NC]
RewriteRule ^ /%1/%2/%3? [R=302,L,NE]
RewriteCond %{THE_REQUEST} \s/+(.+?)\.php\s [NC]
RewriteRule ^ /%1 [R=302,L,NE]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+?)/?$ $1.php [L]
var loc = window.location.pathname;
var dir = loc.substring(0, loc.lastIndexOf('/create'));
$.post( dir + "/creategetpostdata.php", xyz.find('.contentfinder').serialize(), function(response) {
//alert( "success" );
xyz.children('.showPostData').html(response);
xyz.children('.showPostData').show();
});