0

I am attempting to pull some Zillow data from XML but am having trouble loading the XML. My code is as follows (I replaced the API key with API KEY in URL):

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

<script>
$.ajax({
url: "http://www.zillow.com/webservice/GetDeepSearchResults.htm?zws-id=API KEY&address=10608+floral+park+lane&citystatezip=20878",
dataType: 'xml',
success: function(data){
    console.log(data);

}

});

</script>

However, I am getting the following error:

XMLHttpRequest cannot load http://www.zillow.com/webservice/GetDeepSearchResults.htm?zws-id=API KEY&address=10608+floral+park+lane&citystatezip=20878. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http:// WEBSITE DOMAIN' is therefore not allowed access.

Could anybody point me in the right direction / tell me what exactly is going on?

Timothy Groote
  • 8,614
  • 26
  • 52

1 Answers1

1

It's a cross domain request - you're only allowed to request resources from your own domain.

Zillow doesn't support a JavaScript API so you would need to create your own server-side service that queries it (forwards the query) and sits on the same domain as your HTML page. Then you can call it (as a proxy).

johnnycardy
  • 3,049
  • 1
  • 17
  • 27
  • This makes sense. Do you happen to have a link to any tutorials or examples of this? I'm clearly a noob and have failed at googling this for myself. – user2832516 Jan 03 '14 at 00:00
  • Try this (step 4): http://jquery-howto.blogspot.co.uk/2013/09/jquery-cross-domain-ajax-request.html#proxy – johnnycardy Jan 03 '14 at 09:27