Skip to main content

jquery ajax jQuery Ajax calls return null

When I enter the API urlsURLs into my browser they work, but when I try from jQuery they just return null. When I open the htmlHTML below, all I get is an alert that says null, despite the fact that FirebugFirebug shows me that the correct request was made. Thanks for your help!

<html>
    <head>
        <title>Test</title> 
   
  </head>
    <body>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"
                type="text/javascript"></script>
        <script type="text/javascript">//<![CDATA[
    
         $(document).ready(function(){
        
         $.ajax({
                    url: "http://api.stackoverflow.com/0.8/stats",
                    dataType: 'json',
                    success: function(data, text, xhr){
                        alert(data);
                        alert(text);
                        alert(xhr);
                    }
                });
      
       });
    
         //]]>
        </script>
    </body>
    </html>

jquery ajax calls return null

When I enter the API urls into my browser they work, but when I try from jQuery they just return null. When I open the html below all I get is an alert that says null, despite the fact that Firebug shows me that the correct request was made. Thanks for your help!

<html>
<head>
<title>Test</title>   
  </head>
    <body>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript">//<![CDATA[
    
       $(document).ready(function(){
        
         $.ajax({
      url: "http://api.stackoverflow.com/0.8/stats",
      dataType: 'json',
      success: function(data, text, xhr){
        alert(data);
        alert(text);
        alert(xhr);
        }
    });
      
       });
    
      //]]>
    </script>
    </body>
    </html>

jQuery Ajax calls return null

When I enter the API URLs into my browser they work, but when I try from jQuery they just return null. When I open the HTML below, all I get is an alert that says null, despite the fact that Firebug shows me that the correct request was made.

<html>
    <head>
        <title>Test</title> 
    </head>
    <body>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"
                type="text/javascript"></script>
        <script type="text/javascript">//<![CDATA[
            $(document).ready(function(){
                $.ajax({
                    url: "http://api.stackoverflow.com/0.8/stats",
                    dataType: 'json',
                    success: function(data, text, xhr){
                        alert(data);
                        alert(text);
                        alert(xhr);
                    }
                });
            });
            //]]>
        </script>
    </body>
</html>
Source Link
Adam
  • 809
  • 8
  • 14

jquery ajax calls return null

When I enter the API urls into my browser they work, but when I try from jQuery they just return null. When I open the html below all I get is an alert that says null, despite the fact that Firebug shows me that the correct request was made. Thanks for your help!

<html>
<head>
<title>Test</title>   
 </head>
    <body>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript">//<![CDATA[
    
      $(document).ready(function(){
        
        $.ajax({
      url: "http://api.stackoverflow.com/0.8/stats",
      dataType: 'json',
      success: function(data, text, xhr){
        alert(data);
        alert(text);
        alert(xhr);
        }
    });
      
      });
    
     //]]>
    </script>
    </body>
    </html>