Jump to content

Pedido Request CTT


Recommended Posts


Olá Pessoal,

Estou a fazer um trabalho para a univ, e estou fazer um request aos ctt, para saber a localização de um objecto, mas dá me sempre erro :X

Diz sempre canceled. já ando aqui há imenso tempo e não sei porque.

Alguém me dá uma dica?

<!DOCTYPE html>
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
    <meta charset="UTF-8">
   <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">

  type: 'POST',
  data: 'objects=&showResults=true&pesqObjecto.objectoId=RC992163877PT',

    success: function(retorno){
  },error: function(xhr,status,err){
		 alert("DEBUG: status"+status+" \nError:"+err+"-->"+xhr.statusText);

   <body >

    <input id="enviar" type="button" onclick=""/>
    <input id="result" type="text" />
Link to post
Share on other sites
XMLHttpRequest cannot load http://www.ctt.pt/feapl_2/app/open/objectSearch/cttObjectSearch.jspx. No 'Access-Control-Allow-Origin' header is present on the requested resource.

As the source (origin) page and the target URL are at different domains, your code is actually attempting to make a Cross-domain (CORS) request, not an ordinary GET.

In a few words, the same-origin policy enforces that browsers only allow Ajax calls to services in thesame domain as the HTML page.


Eu acho que existem maneiras de contornar esta situação...

Contador de calorias: caloriaspordia.com

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.