I have included an external javascript file whose contents are:
function getTopNews(){
  $.ajax({
    url: 'http://api.feedzilla.com/v1/categories/26/articles.json',
    type: 'GET',
    dataType: 'json',
    success: function(response){
        alert("Got top news!");
    },
    error: function(){
        alert("There was an error!");
    },
    complete: function(){
        alert('Executed');
    }
  });
}
Now the above javascript file is included in another file where I have written this code:
$(document).ready(getTopNews);  // works
Now suppose my getTopNews is defined like getTopNews(var newsId), then how should I call it? I have tried following and it does not work:
$(document).ready(getTopNews(26));  // does not work
$(document).ready(fucntion(){  // does not work
  $(this).getTopNews(26)
});
Both of these do not work for me. Help!




getTopNews(var newsId).