开发者

jquery ajax call with xml query not working. Need advice

开发者 https://www.devze.com 2023-04-10 21:37 出处:网络
I\'ve written some code that is supposed to load an xml file via AJAX, parse a couple variables, and alert them to the screen.It isn\'t working...Can any guru\'s out there tell me what I\'ve done wron

I've written some code that is supposed to load an xml file via AJAX, parse a couple variables, and alert them to the screen. It isn't working... Can any guru's out there tell me what I've done wrong??

<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
    $.get("http://www.greenshipping.com/api/requestAccountSummary.php?UID=7ef364b35ca79b0497f391da7f6776ab", {}, function(xml) {
        $('result', xml).each(function(i) {
            num_shipments = $(this).find('num_shipments_offset').text();
            lbs_开发者_StackOverflow社区carbon = $(this).find('total_lbs_carbon_offset').text();
            alert("num_shipments:"+num_shipments+" lbs_carbon:"+lbs_carbon);
        });
    });
});
</script>
</head>
<body>

</body>
</html>


If your code isn't also in the domain http://www.greenshipping.com, then you're being blocked on purpose. Cross-domain AJAX requests are banned unless the user has already granted special permission.

0

精彩评论

暂无评论...
验证码 换一张
取 消