views:

245

answers:

1

Hi,

I am using xampp to test my codes. I am using dreamweaver live view. In live view, and return a xmlhttp.status code of 200 and echo outputs. But when I try to view it in IE or FF, the status code is 0, and no output. I read that this seems to be a problem with the URL (absolute/relative??), I tried multiple URL formats, but can't seem to get it to work.

Basically, I have an html file that calls the javascript function "result()", the "result" functions calls to execute a test3.php file.

The location of file to be called is C://xampp/htdocs/test/ha/test3.php

I tested file:///C://xampp/htdocs/test/ha/test3.php or C://xampp/htdocs/test/ha/test3.php or file:///xampp/htdocs/test/ha/test3.phpPlease suggest a URL format (the complete url).

my code is below, as is, the relative url in the line works in DW live view, but not when independently accessed with FF/IE browsers

xmlhttp.open("GET","../ha/test3.php",true);

What should I replace the url with for it to work?

TIA

function Result() 
{


xmlhttp = ajaxFunction();
//document.getElementById("results").innerHTML += " ajax function got executed";

xmlhttp.onreadystatechange=function()
  {

  document.getElementById("results").innerHTML += xmlhttp.readyState; //readystate check/debug
  document.getElementById("results").innerHTML += xmlhttp.status; //status check/debug

   if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
      document.getElementById("results").innerHTML += "onreadystate";  //readystate check/debug

      document.getElementById("results").innerHTML += xmlhttp.responseText;



    }

    }
  }//onreadystate bracket



xmlhttp.open("GET","../ha/test3.php",true);

xmlhttp.send();

} //result function bracket
A: 

if you are pointing IE or FF at a file on your disk, and your file uses ajax for an http://localhost/app/blah you are violating the same origin policy.

You can change this in firefox by about:config by toggling:

security.fileuri.strict_origin_policy

there are also java script solutions for this that change the browsers security settings.

hvgotcodes
Thanks for the reply, but I am still not sure how to get this to work.
jamex