0
我不能用Ajax调用无法获得与Ajax调用正确的路线
在我看来,正确的路线我有2个HTML按钮用PHP创建
<?php if ($comment_exist == null): ?>
<p><input type ="button" id = "sb" value="I Comment"></p>
<?php else: ?>
<p><input type ="button" id = "sb2" value="I Cancel my Comment"></p>
<?php endif ?>
我的jQuery脚本包含以下
<script>
$(document).ready(function(){
$(function(){
$("#sb").click(function(e){
$.ajax({
type: "POST",
url: "comment/create",
success: function(data) {
$("#message_ajax").html("<div class='successMessage'>" + data.message +"</div>");
}
});
});
});
});
</script>
我得到了以下地址
localhost/mysite/index.php/post/comment/create
代替
localhost/mysite/index.php/comment/create
我必须说,我的观点,我有按钮由柱控制器 推出,我想打电话给评论控制器的创建视图。而我使用Yii框架
预先感谢您的帮助
更改URL以'“/index.php/comment/create”'或者如果您配置htaccess文件,你会怎么做'“/评论/创建“' –