Kohana ajax gives an error Error 403. Why and how to get around?

I'm developing a website in Kohana framework. I have code that will be repeated. Code in JS and PHP. I decided to create a class and put this code. And then call it in those places where it is needed.

Here is the code in JavaScript:

public static function tags() { ?>
 $('.input-tags-wrap input').autocomplete({
 source: function (request, response) {
$.ajax({
 url: "/application/classes/CommonFunctions/autocompletetag",
 dataType: "json",
data:
{
 maxRows: 12,
 startsWith: request.term
},
 success: function (data) {
 response($.map(data.message.data, function (item) {
 return {
 label: item.name
 value: item.name
};
}));
 }, 
 error: function (data) {
$('html').html(data.responseText);
}
});
},
 minLength: 1,
 delay: 50
 });


Here's the code in php (this is a function for JavaScript code:

autocompletetag function() {
 if (!$_GET['startsWith'] OR ! Request::initial()->is_ajax())
 return $this->render_ajax('Invalid request', false);

 $query = 'SELECT `name`, `is_show`
 FROM `tags`
 WHERE is_show = 1 AND name LIKE "%' . $_GET['startsWith'] . '%" and id != 54 LIMIT 0, ' . $_GET['maxRows'];

 $result = DB::query(Database::SELECT, $query)
->execute()
->as_array();

 $this->render_ajax(array('data' => $result));
 }

I call the code like so:

<?php echo CommonFunctions::tags(); ?>

When I start to enter something in my field with autocomplete, I get the error:

Access forbidden!
You don't have permission to access the requested object. It is either read-protected or not readable by the server.
If you think this is a server error, please contact the webmaster.
Error 403


Tell me, please, why this is so. And how can I circumvent this error?
June 10th 19 at 16:08
1 answer
June 10th 19 at 16:10
Solution
Good afternoon.
Here is the translation error.
Access denied!
You don't have permission to access the requested object. It is either read protected or not readable by the server.
If you think this is a server error, please contact the webmaster.
Error 403

This means that You need to check access rights to directories and files.
Directories - 755
For files - 644

p.s.
When making a code, use specific tags and not the tag "quote"
Thanks for the reply. But if I can configure the rights. Is it possible to do as I did? I mean, is this the right approach? Or with repetitive code like some other fighting? If I don't have access to such a trivial task, I guess, means that I somehow incorrectly decide it? - melvina_Rolfs commented on June 10th 19 at 16:13
answered the question
Kohana ajax gives an error Error 403. Why and how to get around?

Do not run up against comments from modders.

And the rights are easily configured in the properties of the file/directory in any FTP client. - rhianna_Fee commented on June 10th 19 at 16:16
Is it possible to do as I did? I mean, is this the right approach?

as You did not. To configure the rights you need.
With the help of ajax we need to pass only parameters to the server is there to process this data, and in response to give the result of the server.
Rights are easily configured through the hosting control panel or via ftp or via ssh(if You have provided such rights to the admins.) - Dion77 commented on June 10th 19 at 16:19

Find more questions by tags Kohana