Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

415
Views
Error al ejecutar 'abrir' en 'XMLHttpRequest': URL no válida

Tengo un error de tiempo de ejecución:

Error al ejecutar 'abrir' en 'XMLHttpRequest': Error de URL no válida: Error al ejecutar 'abrir' en 'XMLHttpRequest': URL no válida en http://localhost:8100/build/polyfills.js:3:2793 en XMLHttpRequest.open (evaluación en s ( http://localhost:8100/build/polyfills.js:2:29793 ), :3:31)

 import { Injectable } from '@angular/core'; import { Http, Headers } from '@angular/http'; import 'rxjs/add/operator/map'; @Injectable() export class Reviews { data: any; constructor(public http: Http) { this.data = null; } getReviews(){ if (this.data) { return Promise.resolve(this.data); } return new Promise(resolve => { this.http.get('http://localhost:app/api/reviews') .map(res => res.json()) .subscribe(data => { this.data = data; resolve(this.data); }); }); } createReview(review){ let headers = new Headers(); headers.append('Content-Type', 'application/json'); this.http.post('http://localhost:app/api/reviews', JSON.stringify(review), {headers: headers}) .subscribe(res => { console.log(res.json()); }); } deleteReview(id){ this.http.delete('http://localhost:app/api/reviews/' + id).subscribe((res) => { console.log(res.json()); }); } }
over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

http://localhost:app/api/reviews

Esta es una URL no válida (como dice el mensaje de error).

Si tiene un : después del nombre de host, debe ir seguido de un NÚMERO de puerto (y luego la ruta). app no es un número, son tres letras.

over 4 years ago · Santiago Trujillo Report

0

El problema está en tu URL. Lea el mensaje de error correctamente, dice URL no válida

Aquí está utilizando localhost:app en su URL 'http://localhost:app/api/reviews' que es incorrecta. Debe usar algún tipo de número de puerto abierto en lugar de texto aleatorio. Por ejemplo 3000 , 4000 , 5000 , 8080 , 8000 , etc.

Entonces su URL será como esta 'http://localhost:3000/api/reviews'

over 4 years ago · Santiago Trujillo Report

0

En mi caso, estoy enfrentando el mismo problema en reactjs. Descubrí que había un error tipográfico en endpoint(http://:ip) . así que después de corregir eso. problema resuelto

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!