Welcome Guest, Not a member yet? Register   Sign In
XMLHttpRequest error and isAjax not work
#1

i am trying to make the following request with ajax but i get an error - 
XMLHttpRequest cannot load https://api.domain.com/view?id=1&csrf_na...0524468477 due to access control checks.

my script:
Code:
$.ajax({
    url:'https://api.domain.com/view',
    method: 'get',
data: {'id':'<?= session()->get('id') ?>','<?= csrf_token() ?>':'<?= csrf_hash() ?>'},
headers: {'X-Requested-With': 'XMLHttpRequest'},
dataType: "json",
cache: false,
success: function (data) {

url site: https://my.domain.com
controller:
PHP Code:
public function view() {

if (
$this->request->isAJAX())        

 
/* my code */

}


i also think the isAjax check doesn't work either
Reply


Messages In This Thread
XMLHttpRequest error and isAjax not work - by Secux - 09-01-2021, 12:34 PM



Theme © iAndrew 2016 - Forum software by © MyBB