I'm trying to parse the RSS feed generated by Google alerts via jQuery. I can get the XHR request to return XML via a JSON-P however i'm struggling to parse the response.
Then Firebug console throws the following error:
missing ; before statement
<?xml version="1.0"?><feed xmlns:media="http://search.yahoo.com/mrss/" xmlns:gr=...
From what I've read this is because the response is being evaluated as script
and not xml
, but i could be wrong!
I've tried to implement the following solutions from related questions:
jQuery ajax request using jsonp error
jQuery XML parsing with namespaces
and this trick sheet:
http://code.google.com/p/jquery-jsonp/wiki/TipsAndTricks
Create a google alerts feed here: http://www.google.com/alerts
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>google alerts....</title>
</head>
<body>
<h1>Google alerts</h1>
<div></div>
</body>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
<!--
jQuery(function() {
$.ajax({
type: "GET",
url: "GOOGLE ALERT FEED URL",
dataType: "jsonp xml"
}).done(function(data) {
console.log(data);
}).fail(function(jq_xhr, text_status) {
console.log("Error: " + text_status);
});
});
-->
</script>
Any advice would be appreciated, Cheers.