Created
August 5, 2011 14:40
-
-
Save chebyte/1127673 to your computer and use it in GitHub Desktop.
get url title with jquery and yql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#other').change(function(){ | |
var url = $(this).val(); | |
var yql_url = "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D%22" + encodeURIComponent(url) + "%22%20and%0A%20%20%20%20%20%20xpath%3D'%2F%2Ftitle'&format=json&callback=?"; | |
$.getJSON(yql_url, function(json) { | |
if (json && json.query && json.query.results && json.query.results.title) { | |
alert(json.query.results.title); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment