Annapurna Annapurna - 2 years ago 39
Ajax Question

use get() inside each() in Jquery and perform action in client side itself

I want to make this Ajax call using get() inside each() function to fetch data from the files, looping through the each().

this is my piece of code:

jQuery.each(html_files, function(index,post_html){
jQuery.get(post_html, function(data){
// do action

here, html_files is an array, containing list of html files.

However, i am only able to fetch the data for the first file.
How do i execute this synchronously.

Thanks in advance!

Answer Source
jQuery.each(html_files, function(index,post_html){
        url:post_html, //or the url to fetch data

Check this out

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download