in Education by
I am trying develop first app in ionic and with codeigniter backend but facing Response for preflight has invalid HTTP status code 405 problem in ionic + CI backend issue help me to solve this issue. My controller.js: .controller('SingUpCtrl',function($scope,$http){ $scope.signup_cancel = function (){ $state.go('app.login'); }; $scope.signUp=function(){ $scope.data = {}; var postData = { "user_first_name":$scope.data.user_first_name, "user_last_name" :$scope.data.user_last_name, "user_gender" :$scope.data.user_gender, "user_dob" :$scope.data.user_dob, "user_email" :$scope.data.user_email, "user_password" :$scope.data.user_password }; var link = 'http://maghnusideas.com/ionic/index.php/api/places/user'; var header={ "cache-control": "no-cache", "postman-token": "6cfae124-631b-9367-89c7-04c0a12ab489" } $http.post(link, postData,header).then(function (res){ console.log('success'); var json_obj = JSON.stringify(res.data); json_obj = JSON.parse(json_obj); $ionicPopup.alert({ template: json_obj.message }); }); }; My webapi code in codeigniter: public function user_post() { $this->load->library('form_validation'); $this->load->model('Admin_model'); $this->form_validation->set_rules('first_name', 'First Name', 'required'); $this->form_validation->set_rules('last_name', 'Last Name', 'required'); $this->form_validation->set_rules('gender', 'Gender', 'required'); $this->form_validation->set_rules('dob', 'Date of Birth', 'required'); $this->form_validation->set_rules('email', 'Email', 'required|valid_email'); $this->form_validation->set_rules('password', 'Password', 'required'); if($this->form_validation->run()) { $first_name=$this->input->post('first_name'); $last_name=$this->input->post('last_name'); $gender=$this->input->post('gender'); $dob=$this->input->post('dob'); $email=$this->input->post('email'); $password=$this->input->post('password'); } else{ $this->set_response('Failure to add', REST_Controller::HTTP_BAD_REQUEST); } $result=$this->Admin_model->insert('tbl_user',array('user_first_name'=>$first_name,'user_last_name'=>$last_name,'user_gender'=>$gender,'user_dob'=>$dob,'user_email'=>$email,'user_password'=>$password)); if($result) { $this->set_response('User Registered Successfully...!', REST_Controller::HTTP_OK); }else { $this->set_response('Inserted Data not Proper', REST_Controller::HTTP_BAD_REQUEST); } } JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
This error is related to CORS To fix this you can use ionic proxy feature - see http://ionicinaction.com/blog/how-to-fix-cors-issues-revisited/ or here http://blog.ionic.io/handling-cors-issues-in-ionic/

Related questions

0 votes
    An unhandled exception of type System.AggregateException occurred in mscorlib.dll Inner Exception: {"Response status ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 14, 2022 in Education by JackTerrance
0 votes
    What HTTP Status Code 500 states in RESTful?...
asked Nov 7, 2020 in Technology by JackTerrance
0 votes
    What HTTP Status Code 409 states in REST?...
asked Nov 7, 2020 in Technology by JackTerrance
0 votes
    What HTTP Status Code 404 states in RESTful?...
asked Nov 7, 2020 in Technology by JackTerrance
0 votes
    What HTTP Status Code 401 states in RESTful?...
asked Nov 7, 2020 in Technology by JackTerrance
0 votes
    What HTTP Status Code 400 states in RESTful?...
asked Nov 7, 2020 in Technology by JackTerrance
0 votes
    What HTTP Status Code 304 states in RESTful?...
asked Nov 7, 2020 in Technology by JackTerrance
0 votes
    What HTTP Status Code 204 states in RESTful?...
asked Nov 7, 2020 in Technology by JackTerrance
0 votes
    What HTTP Status Code 201 states in RESTful?...
asked Nov 7, 2020 in Technology by JackTerrance
0 votes
    What HTTP Status Code 200 states in RESTful?...
asked Nov 7, 2020 in Technology by JackTerrance
0 votes
    What is the purpose of HTTP Status Code?...
asked Nov 7, 2020 in Technology by JackTerrance
0 votes
    I have written tests with Selenium2/WebDriver and want to test if HTTP Request returns an HTTP 403 Forbidden. ... Selenium WebDriver? Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    Which among the below directives belonging to the Cache-Control header of HTTP response provide information to the server that the ... -revalidate 3. no-cache 4. None of the above...
asked Jun 24, 2021 in Technology by JackTerrance
0 votes
    Which directive of Cache Control Header of HTTP response provides indication to server to revalidate resource if max-age has passed?...
asked Nov 7, 2020 in Technology by JackTerrance
0 votes
    When dealing with mobile clients it is very common to have multisecond delays during the transmission of HTTP ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 17, 2022 in Education by JackTerrance
...