setInterval not working for ajax call

I have a getJson call to a webservice and works fine, Now I'm trying to make the request every 10 sec. using setInterval with a callback function to fire an alert pop up. I can't make it work. Here's the code:

function ajxCall(){
   $.getJSON('http://api.tubeupdates.com/?method=get.status&lines=all&return=name,status,messages,status_starts&jsonp=?',
         function (result){
               $.each(result.response.lines, function(i, item){
                    $('#status').append("<p>"+item.name + " - " + item.status + " <br><b>" +item.messages + "</b> " + item.status_starts + "</p>");
               });
         }); 
    }

setInterval(ajxCall(), (10 * 1000), function(){
    alert('called!')
});

What am I doing wrong?

Thanks in advance,

Mauro

Answers


 setInterval(function() {
      ajxCall();
   }, 10000);

Try that


Need Your Help

What is the correct way to add new generated model file? in VS 2010 EF

visual-studio-2010 entity-framework

I am using the EF in VS2010. I first created a DB and then choose create model from DB.. Then I go and choose Add Code Generation item.. everything looks good so far. Now I added a new table in my...

How to open a pop-up window using Ajax Control

c# asp.net ajax

I am developing a website, as i have to display a product details in a pop-up window, when a product is clicked. i want to open that pop-up window in secure manner so that the address bar in the po...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.