Based on some research i went through i believe that XmlHttpRequest doesn't permit cross-domain data-exchange directly.Thus my below code does not connect to the getstopname.php file stored on the webserver(1freehosting.com). 

How do i convert my below Java script code so that it can access the php file stored on a remote web server directly ? 

```
  function getDirection(str)
              {  
              if (str=="")
                {
                document.getElementById("select-choice-direction").innerHTML="";
                return;
                } 

              if (window.XMLHttpRequest)
                {
                xmlhttp=new XMLHttpRequest();
                }
              else
                {
                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                }
              xmlhttp.onreadystatechange=function()
                {
                if (xmlhttp.readyState==4 && xmlhttp.status==200)
                  {

                   $('#select-choice-stopname').html(xmlhttp.responseText).selectmenu( "refresh");
                   $('#select-choice-stopname-postuser').html(xmlhttp.responseText).selectmenu( "refresh");
                 }
                }
              xmlhttp.open("GET","http://www.xyz.com/getstopname.php?direction="+str.value+"&bus="+busnum+"&dayofweek="+dayofweek,true);
              xmlhttp.send();
              }

```

getstopname.php file (stored on a diffrent web webserver)

```
<?php

$bus = intval($_GET['bus']);
$q = $_GET['direction'];
$dayofweek = $_GET['dayofweek'];

$con=mysqli_connect("xyz.com","root","root123","db1","3306");

ct_db($con,"db1");

$result = mysqli_query($con,"SELECT StopNames FROM cfv_busstopnames WHERE UniqueBusId = '".$q."' and busnumber = ".$bus."  and Dayofweek = '".$dayofweek."' ");

  echo "<option>" . "Pick Stop  Names? ". "</option>" ;

while($row = mysqli_fetch_array($result))
  {

  echo "<option>" . $row['StopNames'] . "</option>" ;

  }

?>

```