[英]server error 500 in ajax
我正在使用codeigniter。我有一個名為“ User”的控制器,在該控制器中有一個名為“ apply”的方法,該方法已綁定到表單。使用ajax我試圖實現一個發布請求,但作為回報,我得到了內部服務器錯誤500錯誤。如何解決此問題。我將我的index.php頁面由.htaccess文件刪除了
$.ajax({
url:'http://localhost/mycodeigniter/ci/user/apply',
type:'POST',
data:{
start:'3/3/2012',
end :'4/3/2012',
reason:'sick'
},
success: function( data, textStatus, jQxhr ){
alert( data );
},
error: function( jqXhr, textStatus, errorThrown ){
alert( 'baler '+errorThrown );
}
});
嘗試通過方法訪問URL:
http://localhost/mycodeigniter/ci/user/apply
或者嘗試http://localhost/mycodeigniter/index.php/ci/user/appl
由於您未使用HMVC
,因此通常應訪問如下控制器的方法:
your-local-project-path/controller-name/method-name
因此,以上請求應在以下URL上運行http://localhost/mycodeigniter/user/apply
這可能對您有幫助
/*
|my sql date formate is 2012-3-4
|and if not then first check your date in mysql and change your date according to this "date()" method |used below
*/
public function get_detail()
{
$start = $this->input->post('start');
$end = $this->input->post('end');
$reason = $this->input->post('reason');
$start_date = date('Y-m-d',$start);
$end_date = date('Y-m-d',$end);
/*Pass data in model through function */
$data = $this->model_name->function_name($start_date,$end_date,$reason);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.