Hopefully this question doesn't sound too amateurish! Just looking for some advice on how to get this. I really appreciate any help:
I have built an Ionic app and use Laravel as my API. I have no problems connecting these, and have made many requests. My question comes with how I can best submit large blocks of text to the API in a proper manner.
For example, I have a route such as this:
Route::post('/api/v1/task/add/{taskdescription}',function($taskdescription) {
DB::insert('INSERT INTO tasks(task) VALUES (?)', [$taskdescription]);
});
Then in my Ionic controller, I have this:
$scope.saveNewTask = function() {
$http.post(API_URL+'task/add/'+$scope.data.taskdescription)
.success(function() {
//Success Function
})
.error(function(err) {
//Error Function
});
};
This task description, however...I would like to be able to input html characters and % signs, and /, but whenever I add something such as the % or /, it does not work correctly as the $http.post URL then gets messed up. Does anyone know how I can "escape" or similar to be able to post complex and, potentially very long, pieces of data through an API call such as this?
Perhaps there is a better way to send this data that I am not aware of?