2016-05-17 96 views
1

通常在覈心php中,如果我們嘗試使用ajax發出請求,我們會設置存在查詢的文件的url,因此在codeigniter中切換相同的進程時,我得到了一個響應錯誤,任何人都可以幫助我出此錯誤我在codeigniter中出現錯誤

網:: ERR_SSL_PROTOCOL_ERROR

這裏是我的代碼 的Javascript AJAX

$.ajax ({ 
       type  : "POST", 
       url  : "https://localhost:90/tufuturo/home/register", 
       data  : {username: username, email: email, password: confirm_password}, 
       dataType : "text", 
       success : function(data, text, xhr) { 
        if(xhr == 200) { 
         var return_data = data; 
         $('#messagebox').fadeIn(2000, function() { 
          $(this).html("<div class='message'>"+return_data+"</div>").delay(4000).fadeOut(3000); 
         }); 
        } 
       } 
      }); 

這裏是代碼的形式我Home.php控制器

public function register() { 
     $this->load->library('form_validation'); 
     $this->form_validation->set_rules('username', '', 'required|trim|is_unique[users.username]'); 
     $this->form_validation->set_rules('password', '', 'md5|trim'); 

     if($this->form_validation->run()) { 
      $data = array(
       'username' => $this->input->post('username'), 
       'password' => $this->input->post('password'), 
       'email'  => $this->input->post('email'), 
       'type'  => 'user' 
      ); 

      $this->data_insert->add_admin($data); 
      echo 'New admin has been successfully created'; 
     } else { 
      echo 'Username already taken'; 
     } 
    } 

請讓我知道我怎樣才能擺脫這種錯誤的

+0

爲什麼在本地系統中使用https? –

回答

2

本地主機不符合https協議

變化從https://localhost:90/tufuturo/home/register 網址http://localhost:90/tufuturo/home/register

如果你想工作與https協議您需要generate certificate

+0

當我改變https爲http什麼都沒有發生現在應該刪除http以及? –

+0

不,你確定你正在聽的端口是'90'嗎? –

+0

是的我怎麼能驗證,如果我得到任何迴應將回聲在控制器的工作將它給我們的迴應?是的,我確定,因爲我直接從瀏覽器運行文件,它正在工作 –

0

如果您使用SSL(https ),也許你需要:90你的網址。

+0

您可以使用通過端口'90'的'HTTPS',默認是'443',但你可以聽你想要的任何端口(只要它是可用的) –

+0

我正在使用90因爲Skype的,如果我運行Skype的wamp服務器停止所以這就是爲什麼我改變我的端口爲90 –

相關問題