views:

32

answers:

1

I'm trying to use the Yelp API to get local restaurants depending on the user's latitude and longitude. The trouble is that I'm quite sure how to do this. Looking at the page that I need to retrieve the data from, it says that the type is text/plain. Can I use Ajax to do this or will I not be able to since it is a different domain?

EDIT: The page I am trying to retrieve the contents from is: http://api.yelp.com/business_review_search?term=yelp&tl_lat=37.9&tl_long=-122.5&br_lat=37.788022&br_long=-122.399797&limit=3&ywsid=w_HyGEVjKFHYZdJC9DQBHg

I could do this in PHP no problem using file_get_contents() but the site is built using asp. Is there a similar function in asp? I could maybe use an intermediate page as a sort of proxy for getting and outputting the data.

A: 

I ended up using an intermediate page that grabbed the page from Yelp and outputted the JSON. Here is a snippet of code:

SET XmlObj = Server.CreateObject("Microsoft.XMLHTTP")
XmlObj.open "POST", url, FALSE
XmlObj.send
Response.write(XmlObj.responseText)

On my original page I used Ajax to grab the output from my intermediate page and then JavaScript to decode the JSON and output the results.

It works fine but I'm sure there's a better way.

birderic