Resource: net::ERR_CONNECTION_REFUSED - Ionic Version 3.x

Asked

Viewed 156 times

-1

this is my first post here, and I hope you can help me.

I am new in the area of application development and I am starting to develop an application in Ionic for my TCC, whose purpose is to bring the news of the official website of the campus IFSP - VOTUPORANGA, for the application to take the news closer to the students, employees and management. For ethical reasons I do not have direct access to the official database, and I will have to access through a "web service" that will simply pull the data from the database, convert to JSON and I will have to read the JSON and show on the screen. I received a "copy" without sensitive data from the database and had to find the table responsible for the news shown and try to do the part that converts to JSON myself and to test if it really worked needed to test in place and am having the following error:

Imagem descritiva do problema

And good codes related to the pages needed to do this. It is worth mentioning that I tested and presented to "pre-bank" a version pulled from an API, called themoviedb, to show that it was possible my idea and to have permission of continuity of research.

It follows the codes: noticia.ts -> is an Ionic Provider

inserir a descrição da imagem aqui

home.ts -> is the typscript page from which it should be inserted if everything goes right inserir a descrição da imagem aqui

home.html -> is the page where it is displayed

inserir a descrição da imagem aqui

I hope you can help me!

  • Prefer to post text instead of images. So other people can copy the text and do tests and experiments in search of an answer to the question.

1 answer

0

Apparently your backend is denying this request because it is running on localhost. You need to enable CORS in the header of your call in php:

https://enable-cors.org/server_php.html

Basically you will insert the command:

header("Access-Control-Allow-Origin: *");

In the header of your backend so that it will accept certain calls from a different link.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.