Answer the question
In order to leave comments, you need to log in
Kohana ajax throws Error 403. Why and how to get around?
I am developing a website using the Kohana framework. I have code that will repeat. JS and PHP code. I decided to create a class and put this code there. And then call it in those places where it is needed.
Here is the JavaScript code:
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
});
function autocompletetag() {
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));
}
<?php echo CommonFunctions::tags(); ?>
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
Answer the question
In order to leave comments, you need to log in
Good afternoon.
Here is the translation of the error.
Access is denied!
You do not 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
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question