Uncaught (in promise) SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON d
Publicado por Sergio Mateo (3 intervenciones) el 14/11/2022 00:48:02
Estimados, buenas tardes:
Me da ese error después de enviar un mensaje con Swit. Lo raro que en el modulo de clientes lo hace bien y en los otros módulos que lo quiero hacer me da ese error.
Me da ese error después de enviar un mensaje con Swit. Lo raro que en el modulo de clientes lo hace bien y en los otros módulos que lo quiero hacer me da ese error.
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
function enviar_formulario_ajax(e) {
e.preventDefault();
let data = new FormData(this);
let method = this.getAttribute("method");
let action = this.getAttribute("action");
let tipo = this.getAttribute("data-form");
let encabezados = new Headers();
let config = {
method: method,
headers: encabezados,
mode: "cors",
cache: "no-cache",
body: data
};
let texto_alerta;
if (tipo === "save") {
texto_alerta = "Los datos se guardaran en la base de datos";
} else if (tipo === "delete") {
texto_alerta = "Los datos serán eliminados del sistema";
} else if (tipo === "update") {
texto_alerta = "Los datos serán actualizados";
} else if (tipo === "search") {
texto_alerta =
"Se eliminara el término de busqueda y tendras que escribir uno nuevo";
} else if (tipo === "loans") {
texto_alerta = "Desea remover los datos seleccionados";
} else {
texto_alerta = "Quieres realizar la operación solicitada";
}
Swal.fire({
title: "Estas seguro",
text: texto_alerta,
type: "question",
showCancelButton: true,
confirmButtonColor: "#3085d6",
cancelButtonColor: "#d33",
confirmButtonText: "Aceptar",
cancelButtonText: "Cancelar"
}).then((result) => {
if (result.value) {
fetch(action, config)
.then((respuesta) => respuesta.json())
.then((respuesta) => {
return alertas_ajax(respuesta);
});
}
});
}
Valora esta pregunta


0