@flameloki wrote:
Hello
I am fairly new to web service. I made a RESTful web service and integrated it to my web server.
Here is my web service APIpublic function service_get() { $data['services'] = $this->m_klien->getServiceList(); $this->response($data['services']); } public function vehicle_get() { $data['get_vec'] = $this->m_vehicle->get_all(); $this->response($data['get_vec']); } public function order_post() { $data = array ( 'order_date' => $this->post('order_date'), 'start' => $this->post('start'), 'end' => $this->post('end'), 'plate_num' => $this->post('plate_num'), 'vehicle_type' => $this->post('vehicle_type'), 'order_type' => $this->post('order_type'), 'id_clients' => $this->post('id_clients'), 'id_mechanic' => $this->post('id_mechanic'), 'payment_deadline' => $this->post('payment_deadline'), 'payment_amount' => $this->post('payment_amount'), 'status' => $this->post('status') ); $this->m_klien->setOrder($data, null); }
Now i want to use the post method to save data to my server. Here is what i've been doing :
I followed the instruction here http://learn.ionicframework.com/formulas/backend-data/
my service :.factory('Post', function($resource) { return $resource('http://192.168.137.1/MYWEB/api/Myserver/order'); })
on my controller :
$scope.dummy = { order_date :'2015-09-25 09:00:00', start :'2015-09-27 09:00:00', end :'2015-09-27 09:30:00', plate_num :'AB1234XYZ', vehicle_type : '7', order_type : 'mobile', id_clients : '1', id_mechanic : '1', payment_deadline : '2015-09-25 13:00:00', payment_amount: '500000', status : '1' } $scope.postData = function() { var post = new Post($scope.dummy); post.$save(); }
The problem is the data doesn't seem to be saved on my database. I've tested my API using Wiztools RESTclient and it worked just fine so i know that the problem is on the client side.
Thanks.
Posts: 5
Participants: 2