This is the source code that I want to get the weather from Google
API, Firefox, Safari, Opera will work, but IE can't get the value, so
I did some test, and I found the reason

xml structure in php page
$.get({"a.php"}, '', function() {}, "html"); // all browser work
besides IE
$.get({"a.php"}, '', function() {}, "xml"); // all browser not work

xml structure in xml page
$.get({"a.xml"}, '', function() {}, "html"); // all browser work
$.get({"a.xml"}, '', function() {}, "xml"); // all browser work

How to make IE accept xml that the file extension name is not xml?

<?php
if ($_GET['weather']) {
        echo file_get_contents('http://www.google.com/ig/api?
weather=Taipei');
        exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>weather</title>
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
</head>

<body>
<div id="res"></div>
<input type="button" id="btn" value="btn" />
</body>
</html>
<script>
$(function() {
        $('#btn').click(function() {
                $.get('weather.php?weather=1', '', function(data) {
                        $('#res').html($(data).find('current_conditions').find
('condition').attr('data'));
                });
        });
});
</script>

Reply via email to