Hi. I am trying to send the name of a file which is going to be launched for execution using a script from a *.js file. So in the original *.php file i have imported the *.js file like this:
<script type = "text/javascript" src = "getListsInfo.js"></script>
Then, i use the onclick event on a radio button to call the function form *.js file:
<label>
<input type="radio" name="name1" value="value" id="name1_0" onclick="function(param1, param2)"/>
Description</label>
Now this is the script which calls the file which is going to be executed
function FUNCTION(param1, param2){
var strURL = "file.php?var1="+val1+"&var2="+val2;
var req = getXMLHTTP();
if(req){
req.onreadystatechange = function(){
if(req.readyState == 4){
if(req.status == 200){
document.getElementById(var2).innerHTML = req.responseText;
}else{
alert("There was a problem while using XMLHTTP:\n"+req.statusText);
}
}
}
req.open("GET", strURL, true);
req.send(null);
}
}
The question is how can i transfer the name of the file (file.php) which is going to be executed by the script above (in the *.js file), from the html/php from which I call the function FUNCTION, into the same script (from the *.js file) as a parameter, to make it dynamic. Now i have to write different scripts in case I want to do the same for several files.
Hope its clear want I want to do. Thank you!