Reputation: 65
I want to get the data from http://whatismyip.com/automation/n09230945.asp
using JavaScript. How can I do this?
I can get the data from ASP.NET by using WebClient class but how can we get data using JavaScript?
Upvotes: 1
Views: 800
Reputation: 3126
Use YQL - http://developer.yahoo.com/yql/guide/yql-code-examples.html#yql_html_scraper
It essentially acts as a proxy to grab page data for you through their service. You can interact with it solely with JavaScript.
Upvotes: 0
Reputation: 1326
The way to get around the same origin policy is to write a script in ASP on your own server that gets the data, and then get that script through AJAX in your page.
Upvotes: 0
Reputation: 38603
You will need to use AJAX. However, unless the service provides a JSONP interface, AJAX is limited to getting pages from the same domain as the page it runs on. See: Same origin policy.
Upvotes: 4