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
    });

```
create script

```
  var head= document.getElementsByTagName('head')[0];
  var script= document.createElement('script');
  script.type= 'text/javascript';
  script.src= 'your source';
  script.onreadystatechange= function () {
      if (this.readyState == 'complete') useScript();
  }
  script.onload= useScript;
  head.appendChild(script);

```

then

```
function useScript(){
//use your script here
}

```

in this way you add a script tag in your head and set a function to call (`useScript`) when this script is loaded.

Note that the `onreadystatechange` handler works on IE only. The `onload` handler works in other browsers