Marcus Lee February 2016

How do I grab the objects from php Twitter API

So I can get the tweets using Twitter Oauth I can echo the tweets using foreach. But I want to grab the data from the php and bring them to another page.

Index.php contains the json array of tweets.

Then in page2.php I have the code below to display specific objects using $.ajax get from index.php

   $.ajax({
     dataType: "html",
     url: 'index.php',
     success:function(data){
    //$('#tweets').html(data['text']);
    $.each(data, function () {
    list += '<p>'+ this.text +'</p>';
});
    $('#tweets').html(list);
}

});

But when I try to specify the a particular object to grab like the text I get no results. Do use

 data['text'] 

or

data->text

Answers


Kyle E4K February 2016

From observing your current code, you're using the JQuery GET method to send the data to the PHP file.

I am 99% sure that the following should work:

$_GET['list'];

Post Status

Asked in February 2016
Viewed 3,430 times
Voted 12
Answered 1 times

Search




Leave an answer