-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
28 lines (26 loc) · 834 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
$(document).ready(function () {
$("#perguntar").click(function () {
var pergunta = $("#pergunta").val();
console.log(pergunta);
$.ajax({
url: 'conectChat.php',
method: 'post',
dataType: 'json',
data: {
pergunta: pergunta
},
success: function (data) {
console.log(data);
if (data != "error") {
var response = document.getElementById('resposta');
response.textContent = data;
} else {
$("#resposta").val("Erro");
}
},
error: function (xhr, status, error) {
console.log(xhr.responseText);
}
});
});
});