0

Here is the simplified code, I am calling JS inside epr_lib.php.

epr_lib.php is located in cgi-bin folder, that means outside htdocs.

In cgi-bin folder I have these files: epr_lib.php; newrequest.php.

My question is: how can I call in ajaxRequest.open the file that is outside htdocs? Or this is impossible?

var ajaxRequest;
ajaxRequest = new XMLHttpRequest();
ajaxRequest.onreadystatechange = function(){
    if(ajaxRequest.readyState == 4){
        suppl_addrss.innerHTML = ajaxRequest.responseText;
    }
}
ajaxRequest.open("GET", "newrequest.php?task=getsuppladdrss", true);
ajaxRequest.send(null); 

Thank you.

1 Answer 1

1

No, it's not possible. Ajax requests make http requests for the file, so you'd have to have it available in htdocs.

You could create a proxy script that loads the cgi-bin file. Just create a file that will include your cgi-bin file:

// myproxy.php
// you'll have to get the querystring and use it as a variable in newrequest.php
$vars = $_GET("task");
include('../cgi-bin/newrequest.php');
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.