Pass php variable to java function
Salut baieti,
Am o mare problema daca ma poate ajuta cineva
Vreau ca in functia de JS sa duc variabila de php si nu am nici cea mai vaga idee cum
PHP
Cod:
<?
$codid=$_GET["cid"];
echo "
<script>
setTimeout(function() {CSelect();}, 100) ;
</script>
<div id=\"ReloadThis\"></div>";
?>
JS FUNCTION
Cod:
function CSelect()
{
var
$http,
$self = arguments.callee;
if (window.XMLHttpRequest) {
$http = new XMLHttpRequest();
} else if (window.ActiveXObject) {
try {
$http = new ActiveXObject('Msxml2.XMLHTTP');
} catch(e) {
$http = new ActiveXObject('Microsoft.XMLHTTP');
}
}
if ($http) {
$http.onreadystatechange = function()
{
if (/4|^complete$/.test($http.readyState)) {
document.getElementById('ReloadThis').innerHTML = $http.responseText;
setTimeout(function(){$self();}, 10);
}
};
$http.open('GET', 'linii_c/select.php'+'?cod='+'PHP VARIABLE', true);
$http.send(null);
}
}
Cum pot adauga variabila php in aceasta functie?
Multumesc!