I'm using this twitter.class script to get some tweets limited by a max_id parameter:\[code\]<?php $max_id = $_POST['max_id'];class Twitter{ public function __construct(){ } public function searchResults( $search = null ) { $url = "http://search.twitter.com/search.atom?q=" . urlencode( $search ) . "&result_type=recent&rpp=4&max_id=" . $max_id; $curl = curl_init(); curl_setopt( $curl, CURLOPT_URL, $url ); curl_setopt( $curl, CURLOPT_RETURNTRANSFER, 1 ); $result = curl_exec( $curl ); curl_close( $curl ); $return = new SimpleXMLElement( $result ); return $return; } public function echok() { echo $this->max_id; } } ?>\[/code\]This script is required_once by another (test.class.php) that launch a loop and echoes the tweets.
I want to dinamically load 'max_id' depending on the tweets already loaded in page. I get the last 'id' with jQuery and then POST it
I tried to post this variable by jQuery Ajax, and only when finished, load the other scipr to get the tweets. Like this:\[code\]var max_id_pre = $('.ids:last').text();var max_id = 'max_id=' + max_id_pre;$.ajax({url: "twitter.class.php",data: max_id,type: "POST",success: function(){$('#container').load("test.class.php");}}); \[/code\]Is not working since twitter.clas.php is not getting 'max_id' variable, BEFORE being required by test.class.php to stamp the tweets.
I know I'm trying to post a variable to a class, is it possible?Thanks!
I want to dinamically load 'max_id' depending on the tweets already loaded in page. I get the last 'id' with jQuery and then POST it
I tried to post this variable by jQuery Ajax, and only when finished, load the other scipr to get the tweets. Like this:\[code\]var max_id_pre = $('.ids:last').text();var max_id = 'max_id=' + max_id_pre;$.ajax({url: "twitter.class.php",data: max_id,type: "POST",success: function(){$('#container').load("test.class.php");}}); \[/code\]Is not working since twitter.clas.php is not getting 'max_id' variable, BEFORE being required by test.class.php to stamp the tweets.
I know I'm trying to post a variable to a class, is it possible?Thanks!