BLUF: Running AJAX call from Chrome extension isn't working properly.
AJAX:
$.ajax({
type: "GET",
url: "http://weather.aero/dataserver_current/httpparam?dataSource=metars&requestType=retrieve&format=xml&stationString=KFBG&hoursBeforeNow=1&fields=raw_text",
dataType: "xml",
success: function(xml){
$(xml).find("raw_text").each(function(){
var metar = $(this).text();
});
$("#ob-body").html(metar);
}
});
So I'm trying to get weather data from a site that requires a GET to request the data XML. They give tips for building the request string for the URL, and upon pasting the URL in the address bar, the appropriate XML data displays correctly.
Next, I assembled the AJAX call and ran it, but nothing seems to happen. I changed the function for the success property to simply 'alert()' and ran the extension again, and the alert box popped up.
The fact that the alert is showing up means that the call was successful, unless i'm totally out to lunch ... so why isn't the original function working? I realize that the code searching the XML might not be right, but placing an alert right before I start dealing with the doc isn't popping up either, which tells me for some reason it's not entering the function at all.
success: function() {alert() }or like thissuccess: alert()? The first one means your call is working; the second does not mean that, because alert will be called right away.