1

Ajax code is given below

function countFolder(){
    var dir='albums';
    var count=0;
    alert(dir);

    $.ajax({
        url: dir,
        async:false,
        success: function (data) {
            $(data).find("a:contains(" + 'album' + ")").each(function () {// function to read foldera name contains 'album'
                count++;
                //alert(url);
            });
        }
    });

    return count;
}

Is there any equalent code for pure javascript?

Marcel Gwerder
  • 8,353
  • 5
  • 35
  • 60
aju2529
  • 65
  • 7
  • 4
    Splitting hairs, that *is* JavaScript code. You probably want the same functionality but without using jQuery? (Note that you can't do it without AJAX. JavaScript by itself doesn't have access to the file system.) – JJJ Sep 30 '13 at 08:55
  • This may help you: http://net.tutsplus.com/articles/news/how-to-make-ajax-requests-with-raw-javascript/ – tbraun89 Sep 30 '13 at 08:56
  • Do not use synchronous JAX. – Bergi Sep 30 '13 at 08:58
  • 1
    @DanFromGermany: [What are the drawbacks of using synchronous ajax call?](http://stackoverflow.com/questions/6517403/what-are-the-drawbacks-of-using-synchronous-ajax-call) and [Is there any reason to use a synchronous XMLHttpRequest?](http://stackoverflow.com/questions/2088318/is-there-any-reason-to-use-a-synchronous-xmlhttprequest) – Bergi Sep 30 '13 at 09:08

0 Answers0