I'm doing a chatbot based project. I came across Chatbase and I wanted to implement chatbase to analyse the data more indept I get from my chatbot. However, I am confused as to how to write the post method to the chatbase api and keeps receiving error 405 or 400. I don't have much experience in writing ajax requests so most probably the problem might be with the format of the code. If anyone is willing to help me out, I would really appreciate it. Thanks
Code for reference:
function chatbaseInput() {
$.ajax({
type: "POST",
url: chatbaseURL,
contentType: "charset=utf-8",
dataType: "json",
headers: {
"Access-Control-Allow-Origin": "website link"
},
data: JSON.stringify({
api_key: "apikey",
type: "user",
user_id: "140012004300",
time_stamp: 1516765680000,
platform: "Website",
message: "Default Welcome Intent",
intent: "Welcome Intent",
version: "1.0"
}),
success: function (data) {
setResponse("Chatbase works!");
},
error: function () {
setResponse("Chatbase not working");
}
});
}