fiz um eskeminha aqui onde me aparece uma lista de produtos, dai teria botões pra excluir, ativar e etc
so q eu queria q quado excluisse ja atualizasse na página, sem dar o refresh
tentei de tudo, pus este codigo e tmb nada
header("Content-type: text/html; charset=iso-8859-1");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
alguma configuração no servidor influencia na atualização disso, ou é o codigo mesmo!
esse é meu código
try{ xmlhttp = new XMLHttpRequest(); }catch(ee){ try{ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }catch(e){ try{ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }catch(E){ xmlhttp = false; } } } repostasCadastro : function(){ mensagens = document.getElementById('msg'); if(xmlhttp.readyState == 1) mensagens.innerHTML = 'Aguarde...'; if(xmlhttp.readyState == 4) { if(xmlhttp.status == 200) { mensagens.innerHTML = xmlhttp.responseText; ajax.listaGaleria(); } } }, listaGaleria : function(){ local = document.getElementById('lista'); xmlhttp.open('GET', 'pass.php?op=open', true); //xmlhttp.setRequestHeader('If-Modified-Since', 'Sat, 1 Jan 2000 00:00:00 GMT'); xmlhttp.onreadystatechange = function(){ if(xmlhttp.readyState == 1) { if(document.getElementById('tabelaLista')) anime.fade(document.getElementById('tabelaLista'), 100, 20, 500); } if(xmlhttp.readyState == 4) { if(xmlhttp.status == 200){ local.innerHTML = xmlhttp.responseText; if(document.getElementById('tabelaLista')) anime.fade(document.getElementById('tabelaLista'), 20, 100, 500); } } } xmlhttp.send(null); }, poejogadorvenda : function(id){ if(confirm("Tem certeza que deseja executar esta ação?!")) { xmlhttp.open('GET', 'pass.php?op=poevenda&id='+id, true); xmlhttp.setRequestHeader('If-Modified-Since', 'Sat, 1 Jan 2000 00:00:00 GMT'); //xmlhttp.onreadystatechange = ajax.repostasCadastro; xmlhttp.send(null); } }, tirajogadorvenda : function(id){ if(confirm("Tem certeza que deseja executar esta ação?!")) { xmlhttp.open('GET', 'pass.php?op=tiravenda&id='+id, true); //xmlhttp.setRequestHeader('If-Modified-Since', 'Sat, 1 Jan 2000 00:00:00 GMT'); xmlhttp.onreadystatechange = ajax.repostasCadastro; xmlhttp.send(null); } }, listaoutrostimes : function(id){ xmlhttp.open('GET', 'pass.php?op=pass&id='+id, true); xmlhttp.onreadystatechange = ajax.repostasCadastro; xmlhttp.send(null); }, status : function(id, active){ if(active==0){ ativo = 1; }else{ ativo = 0; } xmlhttp.open('GET', 'cp.php?op=newjax_change_status&active='+ativo+'&pid='+id, true); xmlhttp.onreadystatechange = ajax.repostasCadastro; xmlhttp.send(null); }, flash : function(id, flash){ if(flash==0){ ativo = 1; }else{ ativo = 0; } xmlhttp.open('GET', 'cp.php?op=newjax_change_flash&flash='+ativo+'&pid='+id, true); xmlhttp.onreadystatechange = ajax.repostasCadastro; xmlhttp.send(null); }, edicaoTratamento : function(){ //mensagens = document.getElementById('msg'); formulario = document.getElementById('cadastra').elements; if(xmlhttp.readyState == 1) formulario[1].value = 'Aguarde...'; if(xmlhttp.readyState == 4) { if(xmlhttp.status == 200) { codigo = eval('('+xmlhttp.responseText+')'); formulario[0].value = codigo[0]; formulario[1].value = codigo[2]; formulario[2].value = codigo[3]; formulario[3].value = codigo[5]; formulario[4].value = codigo[6]; formulario[5].value = codigo[8]; document.getElementById("img1").src = codigo[8]; formulario[6].value = codigo[8]; abrePasta = codigo['pasta']; } } }, editaGaleria : function(id){ xmlhttp.open('GET', 'cp.php?op=newjax_save&edita=1&pid='+id, true); xmlhttp.onreadystatechange = ajax.edicaoTratamento; xmlhttp.send(null); }, verificaDiretorio : function(pasta){ resp = document.getElementById('respotadir'); xmlhttp.open('GET', '../include/dir.php?pasta='+pasta, true); xmlhttp.onreadystatechange = function(){ if(xmlhttp.readyState == 4){ if(xmlhttp.status == 200) { if(xmlhttp.responseText == '1'){ resp.innerHTML = '* pasta ok!'; resp.style.color = '#99CC00'; abrePasta = pasta; }else{ resp.innerHTML = '* pasta não encontrada!'; resp.style.color = '#FF0000'; abrePasta = false; } } } } xmlhttp.send(null); }, listaImagens : function(){ listaFotos = document.getElementById('listaFotos'); listaFotos.style.display = 'block'; if(abrePasta !== null) { xmlhttp.open('GET', '../include/dir.php?imagens=1&dir='+abrePasta, true); xmlhttp.onreadystatechange = function(){ if(xmlhttp.readyState == 1) { listaFotos.innerHTML = "carregando..."; } if(xmlhttp.readyState == 4){ if(xmlhttp.status == 200) { listaFotos.innerHTML = xmlhttp.responseText; } } } xmlhttp.send(null); }else{ alert("Pasta Invalida!"); } }, completaCampo : function(valor){ document.getElementById('foto').value = valor; }, fechaLista : function(){ document.getElementById('listaFotos').style.display = 'none'; } }
aee galera, consegui resolver
pra quem tem o mesmo problema é so por em baixo de cada requisição o codigo
obj.setRequestHeader('If-Modified-Since', 'Sat, 1 Jan 2000 00:00:00 GMT');