Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Galera estou com seguinte erro na paginação por ajax.
Ele apenas está listando as páginas em .php , se tiver noticias.php?id=1 ele não lista a página e da o seguinte erro: Fatal error: require() [function.require]: Failed opening required '?pg=4.php' (include_path='.;C:\php5\pear') in C:\AppServ\www\ajax.php on line 4
Códigos que estou ultizando:
<script>
function ajaxInit(){
var xmlhttp;
try{ xmlhttp = new XMLHttpRequest(); }
catch(ee) {
try{ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
catch(e) {
try{ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
catch(E){ xmlhttp = false ; }
}
}
return xmlhttp;
}
function carregar(pagina, local){
$(local).html('<img src="img/loading.gif" class="gif_load" width="126" height="22" />');
ajax = ajaxInit();
if(ajax){
ajax.open('POST', 'ajax.php', true);
ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
ajax.onreadystatechange = function(){
if(ajax.readyState == 4){
$(local).html('<img src="img/loading.gif" class="gif_load" width="126" height="22" />');
if(ajax.status == 200){ $(local).html(ajax.responseText); }
}
}
ajax.send('pg='+pagina);
}
}
$(document).ready(function(){
$('a.link-ajax').click(function(e){ carregar(this.id, '#ajax_div'); });
});
</script>
<?php
session_start();
header("Content-Type: text/html; charset=iso-8859-1",true);
require($_POST['pg'].'.php');
?>
Obrigado.
Carregando comentários...