StanScates/Tweet.js-Mod

Data is null

Closed this issue · 15 comments

Hi, got this error message in firebug:

TypeError: data is null
if(data.message) {

row 277

Got the same error too. I"m working on localhost, but I don`t think that this might be the issue.

It looks like on a real server is working fine...probably the issue is related to some localhost PHP settings which are not configured properly or disabled.

I've the problem on a real server, didn't tried in local.

@RiccardoRics Then you probably have some issues with some server settings.

I've a shared hosting where i can set the php version, now is 5.2.17 and i'm trying now to switch it to 5.4.12.
But i don't know if i can solve the problem this way.
Always from the shared hosting panel i can modifiy the php.ini file, but also here i don't know if i have to.

@RiccardoRics Not sure what the problem might be, you know, but keep searching for it.

Unfurtunatelly i got limited knowledge on these kind of stuff...

If you turn on debugging, the console reads

tweet.js: Couldn't resolve host '['    ...    jquery.tweet.js:277
Uncaught TypeError: Cannot read property 'statuses' of null    ...    jquery.tweet.js:285

I'm having issues with this, and can't seem to get this implementation to work out of the box. Can anyone help?

I've a shared hosting where i can set the php version, now is 5.2.17 and i'm trying now to switch it to 5.4.12.
But i don't know if i can solve the problem this way.

I have experienced a problem with shared hosting on Windows 2003 Server and PHP 5.2 and upgrading to Windows 2008 Server and PHP 5.4 solved the problem of tweets not loading, so it's definitely worth a go.

For me, this error at JS:277 was down to not having the path to the libs setup correctly because the default directory structure didn't work for me.

It's working nicely. Props to the author!

"tweet.js: Couldn't resolve host '[' ... jquery.tweet.js:277
Uncaught TypeError: Cannot read property 'statuses' of null ... jquery.tweet.js:285"

I have been struggling with this error for some time now and have seem to found a solution. First of all, the project I am working on requires me to use an old jQuery version (1.3.2) which causes trouble. So make sure your jQuery is up to date if possible.
Second of all, the tweet.js tries to nest objects in the $_POST which does not work for some reason. E.g. structure being like array('request' => [object Object]) so getting the needed data fails. This issue might also relate the old jQuery version, but I am not entirely sure.

I have found a solution which seems to work for me. Since I am not quite sure about the origin of this problem and whether it is connected to the outdated jQuery library, I am not going to submit anything into git at this point. Still you can download my fix here: https://www.dropbox.com/s/2a1thwuu9nkun32/twitter.zip

Changes made to the files are the following:
index.php line 24
jquery.tweet.js line 270, 274 - 278

Here is how it works: Basically I am just sending the whole object as a json-formatted string, create an array from that string in the index.php, return the response as a string and not json, since the ajax function does not seem to support the dataType "json" at that point and turn the json string back into a js object.

Can confirm. Had it working on four sites but not a fifth one. Was using jquery-1.3.2.js. Amended to http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js. Worked straight away with no hacks needed

Hi,

I had the same error, I upgraded to http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js and now the error is gone. But I still can't get my tweet displaying on my website (http://www.ridetheflavour.fr/) and I really don't know why...

My php version was 5.3, I set it to 5.4 => http://www.ridetheflavour.fr/twitter/phpinfo.php

no changes. I disabled the caching feature, enabled the logging, checked the Oauth credentials (all 4 are right).

Here is my jquery.tweet.js, as u can see on the second screenshot, I found another modpath ref that I replaced with absolute path as well. is it necessary ?

twit1
twit2
twit3

And here is my index.php :
twit4

OKKKK it works !!!!!

I must have another problem that I solved, but in between I modified

private $lib = '/.lib/'

to

private $lib = 'http://www.ridetheflavour.fr/twitter/lib/'

in index.php and that was a big mistake (as you can see on the picture above). This path must be relative.

So now I'm not sure of what was the real initial problem, and what modification actually solved my problem (it could be javascript conflict removal, php 5.4 update, or even modpath 2nd ref in jquery.tweet.js)

Thank you guys for your help, alone I would have give up long time before. I've never been so happy when looking at a tweet on a web page...strange