- $.ajax({
- url: 'https://api.punjab-zameen.gov.pk/api/tehsil/getAll',
- type: 'GET',
- contentType: "application/json;charset=utf-8",
- beforeSend: function (xhr)
- { xhr.setRequestHeader('Authorization', 'token-Value'); },
- headers: {
- Accept: "application/json;charset=utf-8",
- "Content-Type": "application/json;charset=utf-8"
- },
- accepts: {
- text: "application/json"
- },
- success: function (response) {
- console.log("dfsdfs");
- $.toaster({ priority: "success", title: "Congrat!", message: "Data loading...." });
- //LoadDataTable(aDemoItems);
- },
- error: function (response) {
- $.toaster({ priority: "danger", title: "oooppss!", message: "failed" });
- console.log(response);
- }
- })
i want to send call on this api and get response but when i send without headers then it shows same response of missing authorization token . but when send header so show 400 bad request error
please help.
show this error in browser
Access to XMLHttpRequest at 'https://api.punjab-zameen.gov.pk/api/tehsil/getAll' from origin 'http://localhost:62245' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
(index):206
thanks in advance