Mijal Enzani
Preguntahola se me aparece ReferenceError: $ is not defined saben xq?
const API_URL = 'https://swapi.dev/api/' const PEOPLE_URL = 'people/:id' const opts = { crossDomain: true } function obtainCharacter(id){ return new Promise((resolve, reject)=>{ const url = `${API_URL}${PEOPLE_URL.replace(':id', id)}` $ .get(url, opts, function (data){ resolve(data) }) .fail(() => reject(id)) }) } function onError(id){ console.log(`Sucedió un error al obtener el character ${id}`) } obtainCharacter(1) .then(function (character){ console.log(`El personaje 1 es ${character.name}`) }) .catch(onError)```
Mijal Enzani
lo estoy corriendo en google y por medio del html y sigue sin funcionar, tengo q tener jquery?

Juan Jiménez
Hola, probé tu código y funciona perfecto. Si lo corres desde Google Chrome funciona bien (enlazado a un archivo index.html). Si lo estas corriendo con la extensión "Code Runner" sí marca ese error, necesariamente deberás probarlo en el navegador y revisar la consola.