title: reloading a function or a var in jquery ( newbie )
body: <pre><code>jQuery(document).ready(function(){
  
      // ok im geting the value here maybe i should make it in one var or in a function
      var feedid = $('.feeds .feed:first').attr('id');
      var feedid = feedid.match(/^feed-(\d+)$/);
  
      if (feedid){
          setInterval(function() {
  
              $.ajax({
                  type: 'GET',
                  url: '/area51/ajax',
                  context: $("#ajax-information"),
                  data: { f: feedid[1] },
                  success: function(data) {
  
                      $(this).html(data);
  
                      var feedstatus = $('.ajax-status').attr('id');
                      if (feedstatus == 'none') {
                          $(this).hide();     
                      };
  
                      if (feedstatus == 'true') {
                          $(this).fadeIn().html(data);
                          $('#ajax-information a').click(function(e) {
                              $('.feeds').fadeIn().load('/ .feeds');
                              $('#ajax-information').fadeOut();
                              e.preventDefault();
                          });
                                              // this is what im trying to do
                          feedid.load();
                      };
                  }
              });
          }, 7000);
      };
  });
  </code></pre>
  
  <p>im trying to reload so my feedid is refreshed, is there a way doing this?</p>
  
  <p>edit*</p>
  
  <pre><code>  function getNewFeed(){
        var feedid = $('.feeds .feed:first').attr('id');
        var feedid = feedid.match(/^feed-(\d+)$/);
  
        if (feedid){
          $.ajax({
              type: 'GET',
              url: '/area51/ajax',
              context: $("#ajax-information"),
              data: { f: feedid[1] },
              success: function(data) {
  
                  $(this).html(data);
  
                  var feedstatus = $('.ajax-status').attr('id');
                  if (feedstatus == 'none') {
                      $(this).hide();     
                  };
  
                  if (feedstatus == 'true') {
                      $(this).fadeIn().html(data);
                      $('#ajax-information a').click(function(e) {
                          //I commented the following line because (as i understand)    
                          //getNewFeed() makes the ajax call
                          $('.feeds').fadeIn().load('/ .feeds');
                          $('#ajax-information').fadeOut();
                          e.preventDefault();
                      });
                  };
              }
          });
      }
  }
  
  jQuery(document).ready(function(){
       setInterval(function() {
          getNewFeed();            
       }, 7000);       
  });
  </code></pre>
  
  <p>this one works great! anyway if there is any way better doing this please post it. </p>
  
  <p>thanks for looking in!</p>
  
  <p>Adam Ramadhan</p>