TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Mohsin Arif
295
6k
137.8k
API show 400 Bad Request
Nov 20 2019 6:21 AM
$.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
Reply
Answers (
2
)
How to Generate Request body without model class in swagger
Online registration for booking and register users