página index aqui eu iria colocar um form da para gera um _GET
<!DOCTYPE HTML><html><head><title>ScrollPagination</title><link rel="stylesheet" type="text/css" href="style.css"/><script src="jquery.js"></script><script src="javascript.js"></script><script type="text/javascript" src="//use.typekit.net/vue1oix.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><style type="text/css"></style><script>
$(document).ready(function(){
$('#content').scrollPagination({
nop :10,// The number of posts per scroll to be loaded
offset :0,// Initial offset, begins at 0 in this case
error :'No More Posts!',// When the user reaches the end this is the message that is// displayed. You can change this if you want.
delay :500,// When you scroll down the posts will load after a delayed amount of time.// This is mainly for usability concerns. You can alter this as you see fit
scroll :true// The main bit, if set to false posts will not load as the user scrolls. // but will still load if the user clicks.});});</script></head><body><div id="travel"><a class="sub-head" href="http://www.inserthtml.com/2013/01/scroll-pagination/">« BACK TO ARTICLE</a></div><div id="content"></div></body></html>
aqui ele vai consulta a página ajax.php
javascript
(function($){
$.fn.scrollPagination =function(options){var settings ={
nop :10,// The number of posts per scroll to be loaded
offset :0,// Initial offset, begins at 0 in this case
error :'No More Posts!',// When the user reaches the end this is the message that is// displayed. You can change this if you want.
delay :500,// When you scroll down the posts will load after a delayed amount of time.// This is mainly for usability concerns. You can alter this as you see fit
scroll :true// The main bit, if set to false posts will not load as the user scrolls. // but will still load if the user clicks.}// Extend the options so they work with the pluginif(options){
$.extend(settings, options);}// For each so that we keep chainability.returnthis.each(function(){// Some variables
$this = $(this);
$settings = settings;var offset = $settings.offset;var busy =false;// Checks if the scroll action is happening // so we don't run it multiple times// Custom messages based on settingsif($settings.scroll ==true) $initmessage ='Scroll for more or click here';else $initmessage ='Click for more';// Append custom messages and extra UI
$this.append('<div class="content"></div><div class="loading-bar">'+$initmessage+'</div>');function getData(){// Post data to ajax.php
$.post('ajax.php',{
action :'scrollpagination',
number : $settings.nop,
offset : offset,},function(data){// Change loading bar content (it may have been altered)
$this.find('.loading-bar').html($initmessage);// If there is no data returned, there are no more posts to be shown. Show errorif(data ==""){
$this.find('.loading-bar').html($settings.error);}else{// Offset increases
offset = offset+$settings.nop;// Append the data to the content div
$this.find('.content').append(data);// No longer busy!
busy =false;}});}
getData();// Run function initially// If scrolling is enabledif($settings.scroll ==true){// .. and the user is scrolling
$(window).scroll(function(){// Check the user is at the bottom of the elementif($(window).scrollTop()+ $(window).height()> $this.height()&&!busy){// Now we are working, so busy is true
busy =true;// Tell the user we're loading posts
$this.find('.loading-bar').html('Loading Posts');// Run the function to fetch the data inside a delay// This is useful if you have content in a footer you// want the user to see.
setTimeout(function(){
getData();}, $settings.delay);}});}// Also content can be loaded by clicking the loading bar/
$this.find('.loading-bar').click(function(){if(busy ==false){
busy =true;
getData();}});});}})(jQuery);
aqui eu iria busca o _GET do form da página index sem passa pela página javascript pois si eu passa pela pagina javascript ele cria um bug e buga toda a pagina
<?php
mysql_connect('localhost','username','password')ordie();
mysql_select_db('database');
$offset = is_numeric($_POST['offset'])? $_POST['offset']:die();
$postnumbers = is_numeric($_POST['number'])? $_POST['number']:die();
$run = mysql_query("SELECT * FROM wp_posts WHERE post_status = 'publish' AND post_type ='post' ORDER BY id DESC LIMIT ".$postnumbers." OFFSET ".$offset);while($row = mysql_fetch_array($run)){
$content = substr(strip_tags($row['post_content']),0,500);
echo '<h1><a href="'.$row['guid'].'">'.$row['post_title'].'</a></h1><hr />';
echo '<p>'.$content.'...</p><hr />';}?>
a unica coisa que quero que o _GET do index.php chega no ajax.php sem passa pelo o javascript.js mesmo que tenha que criar algum tipo de função para isso pois si ele passa pelo javascript.js ele faz um loop e o infinite trava qualquer ajuda é bem vida pessoal
Utilizamos cookies e tecnologias semelhantes de acordo com a nossa Política de Privacidade, e ao continuar navegando, você concorda com estas condições.
Pergunta
dumorim
aqui ele vai consulta a página ajax.php
javascript
aqui eu iria busca o _GET do form da página index sem passa pela página javascript pois si eu passa pela pagina javascript ele cria um bug e buga toda a pagina
a unica coisa que quero que o _GET do index.php chega no ajax.php sem passa pelo o javascript.js mesmo que tenha que criar algum tipo de função para isso pois si ele passa pelo javascript.js ele faz um loop e o infinite trava qualquer ajuda é bem vida pessoal
Link para o comentário
Compartilhar em outros sites
0 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.