a da sie tu wywołać funkie a w funkcji zapytanie do bazy
Kod
<script>
funcion save(dan,id)
{
zapytanie
}
</script>
jak ma wyglądać to zapytanie w funkcji
bo opcjonalnie mam tak ale to wykonuje sie w innym pliku i jest niebezpiecznie
Kod
function save (dane,id)
{
var ajaxRequest = false;
if (window.XMLHttpRequest)
{
ajaxRequest = new XMLHttpRequest ();
if (ajaxRequest.overrideMimeType)
{
ajaxRequest.overrideMimeType ('text/xml');
}
}
else if (window.ActiveXObject)
{
try
{
ajaxRequest = new ActiveXObject ("Msxml2.XMLHTTP");
}
catch (exception)
{
ajaxRequest = new ActiveXObject ("Microsoft.XMLHTTP");
}
}
ajaxRequest.open ('GET', 'include/modules/members/save.php?dane=' + dane + '&id='+ id, true);
ajaxRequest.onreadystatechange = function ()
{
if (ajaxRequest.readyState == 1)
{
document.getElementById('spr').style.color = 'blue';
document.getElementById('spr').innerHTML="Sprawdzanie...";
}
else if (ajaxRequest.readyState == 4)
{
if (ajaxRequest.status == 200)
{
document.getElementById('edytuj-'+id).innerHTML="Zapisano";
}
};
ajaxRequest.send (null);
}
bo tak to to w innym pliku