Question: This is my code

```
if (($handle = fopen("data.csv", "r")) !== FALSE) {

while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {

    echo "Title: $data[1]<BR>";
    echo "Time: $data[2]<BR>";
}
echo 'Results End. <hr>';
}

```

I want the horizontal line to appear after each result however it just appears after the last one. What am I missing?

Thanks

Answer: 
try something like 

```
    $.when(
        $.getScript( "sample.js" ),
        $.getScript( "simple.js" ),
        $.getScript( "jquery.js" ),
        $.Deferred(function( deferred ){
        $( deferred.resolve );
       })
       ).done(function(){
            //place your code here, the scripts are all loaded
    });

```
You can retrieve each script via [`$.getScript`](http://api.jquery.com/jQuery.getScript/), which returns a jqXHR object that is also a [Promise](http://api.jquery.com/Types/#Promise).

If you need to get the scripts *in order*, you can chain those together like this:

```
$.getScript("script1.js")
    .then(function() { $.getScript("script2.js"); })
    .then(function() { $.getScript("script3.js"); })
    .then(function() {
        // They're all loaded, do your stuff
    });

```

If the order you load them in doesn't matter, but you just need to know when they're all there, you can load them in parallel and then get called when they're all done using [`$.when`](http://api.jquery.com/jQuery.when/):

```
$.when(
    $.getScript("script1.js"),
    $.getScript("script2.js"),
    $.getScript("script3.js")
).then(function() {
    // They're all loaded, do your stuff
});

```