1. 程式人生 > >jquery中post方法返回404的解決方案

jquery中post方法返回404的解決方案

本文未經作者許可,請勿轉載,業務聯絡 xuanzhaopeng # gmail.com

$.ajax({
		   type: "POST",
		   url: url,
		   data: {
				confirmid : listType,
				sfName : sfName,
				slName : slName,
				sEmail : sEmail
			},
		   success: function(data) {
				var obj = $.parseJSON(data);
				
			
			}
		 );
}

解決辦法;

在.htaccess中,修改apache的mod_rewrite

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteBase /
   
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>