Zoopla Property API Forums


RSS Feed

jQuery and API

    • EdR
    • Topic created 6 years ago

    Has anyone got the API to work with jQuery or javascript? I am struggling. Using the jQuery function $.get (or $.getJSON, or $.ajax) results in a same-origin-policy error. If I use JSONP to get around this, and add "&callback=?" to the query url, I get a parse error from jQuery as the Zoopla API doesn't appear to support callback functions.

    My query is definitely working, and returns all the correct info in JSON format (I can see this using chrome developer tools, or just by pasting the query URL into the browser). However, I cannot get to the data using jQuery as it returns a parse error.

    Message edited by EdR 5 years ago


  1. Matt6 years ago


    We don't support any callback functionality, we only return the data associated with the API request in JSON format.

    Have you considered using a wrapper script on your web server? That would allow you to workaround the policy issues.


  2. EdR6 years ago

    Thanks Matt - have got there in the end. A very short asp script has done the trick.

  3. pukkafish6 years ago

    Ed, I'm having the same problem as you have. How did you manage to get the data? I would prefer a script in PHP, but if you only have ASP, it might be fine ...


  4. Jof Arnold5 years ago

    Here's an example for you, now that Zoopla supports jsonp:

            url: zooplaQueryUrl,
            dataType: "jsonp",
            jsonpCallback: zooplaJsonpFunction,
            success: function(data) {
              console.log("zoopla call : success");
            error: function(jqXHR, textStatus, errorThrown) {
              console.log('zoople call : error ' + textStatus + " " + errorThrown);

    Where zooplaQueryUrl is your API query, and zooplaJsonpFunction is the callback that's triggered after receiving the data. Example of zooplaQueryUrl: http://api.zoopla.co.uk/api/v1/property_listings.js?api_key=KEY&radius0.5&listing_status=rent&postcode=e28aa&page_size=20&jsonp=zooplaJsonpCallback

    Be careful with https versus http - might trip you up. Note the callback must be appended to the end of the URL as shown and must match the one in the options object you construct.

    Hope that helps

[ Page 1 of 1 ]