zobaczcie mam taki kod:
Kod
<head>
<meta http-equiv="Content-type" content="text/html; charset=ISO-8859-2" />
<meta name="Description" content="[ Opis dokumentu ]" />
<meta name="Author" content="[ Autor dokumentu ]" />
<title>[ Tytul dokumentu ]</title>
</head>
<body>
<html>
<script>
var object = false;
if (window.XMLHttpRequest) object = new XMLHttpRequest();
else if (window.ActiveXObject) object = new ActiveXObject("Microsoft.XMLHTTP");
function getData(dataSource, divID)
{
if (object.readyState==4 || object.readyState==0)
{
var obj = document.getElementById(divID);
object.open("GET", dataSource + '&nocache=' + (new Date()).getTime());
object.onreadystatechange = function()
{
if (object.readyState == 4 && object.status ==
zobaczcie mam taki kod:
[code]<head>
<meta http-equiv="Content-type" content="text/html; charset=ISO-8859-2" />
<meta name="Description" content="[ Opis dokumentu ]" />
<meta name="Author" content="[ Autor dokumentu ]" />
<title>[ Tytul dokumentu ]</title>
</head>
<body>
<html>
<script>
var object = false;
if (window.XMLHttpRequest) object = new XMLHttpRequest();
else if (window.ActiveXObject) object = new ActiveXObject("Microsoft.XMLHTTP");
function getData(dataSource, divID)
{
if (object.readyState==4 || object.readyState==0)
{
var obj = document.getElementById(divID);
object.open("GET", dataSource + '&nocache=' + (new Date()).getTime());
object.onreadystatechange = function()
{
if (object.readyState == 4 && object.status == 200)
obj.innerHTML= object.responseText;
}
object.send(null);
}
}
function odswiezaj()
{
getData('ajax.php?id=1','div');
setTimeout("odswiezaj()", 1000);
}
</script>
<div id="div"></div>
<script>
odswiezaj();
</script>
</body>
</html>
i kod php
<?php
if (isset($_GET['id']) && $_GET['id'] == 1
) {
}
?>
i chce przez zmienną php do ajaxu przesłać id
jak widzicie w
getData('ajax.php?id=1','div');
pomoże ktoś?