Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Results always come back empty? #11

Open
btkelly opened this issue Oct 31, 2011 · 6 comments
Open

Results always come back empty? #11

btkelly opened this issue Oct 31, 2011 · 6 comments

Comments

@btkelly
Copy link

btkelly commented Oct 31, 2011

I just dropped in this plugin and the code seems to be running as it should but when it tries to call my success function it crashes on "Uncaught TypeError: Cannot call method 'replace' of undefined". This is caused because the data.results[0] does not exist. Why would this be happening, am I missing something?

Here is the yql script section "jQuery16408109300213400275_1320019527725({"query":{"count":"0","created":"2011-10-31T00:10:05Z","lang":"en-US"},"results":[]});"

Any help would be great. Thanks

Bryan

@alexbarber
Copy link

I'm getting the same issue: "Cannot call method 'replace' of undefined" - did Yahoo change how things work on their end again?

@padolsey
Copy link
Member

May I ask what pages are you requesting?

This doesn't occur for me, on e.g. $.get('http://google.com', function(){...}).

If this is occurring I would guess that it's because YQL wasn't able to get any results. I can only help if you give me more details about the specifics of your issue :)

@alexbarber
Copy link

I've used it with success previously on the blog on
http://www.arthurmeyerson.com

The main site runs in django CMS. On the blog, which runs on WordPress, I
make a call to the main site to scrape the nav with dropdowns at the top of
the page, and then paint that nav in the blog. I do this since the main
site dropdowns change from time to time as photo categories can change.

Now that call returns nothing, so I wondered if something shifted in YQL.

Alex
// ab // alexbarber.com

On Sat, Nov 12, 2011 at 4:06 AM, James Padolsey <
[email protected]

wrote:

May I ask what pages are you requesting?

This doesn't occur for me, on e.g. $.get('http://google.com', function(){...}).

If this is occurring I would guess that it's because YQL wasn't able to
get any results. I can only help if you give me more details about the
specifics of your issue :)


Reply to this email directly or view it on GitHub:

https://github.com/jamespadolsey/jQuery-Plugins/issues/11#issuecomment-2716868

@libricoleur
Copy link

Getting the same issue while it used to work just fine. I can read from my web server's logs that YQL gets the page:

217.146.191.19 kar.chezmandre.net - [13/Nov/2011:00:51:39 +0100] "GET /pub/whoisonchat.pih HTTP/1.0" 200 588 "-" "Mozilla/5.0 (compatible; Yahoo Pipes 2.0; +http://developer.yahoo.com/yql/provider) Gecko/20090729 Firefox/3.5.2"

But data.results[0] is undefined. Tried to switch between jQuery versions with no success, so I guess it's a YQL issue.
BTW I use it like this:

$('#mycontainer').load('http://kar.chezmandre.net/pub/whoisonchat.pih #maindiv');

@padolsey
Copy link
Member

Please have a look at http://developer.yahoo.com/yql/console

Here you can type in your query -- which is essentially what this plugin is doing.

i.e.

SELECT * FROM html WHERE url = "http://YOUR-URL.COM"

YQL will provide you with the results, or errors if it encountered any.

@libricoleur
Copy link

Thank you for your help! I didn't know about this tool.
I finally got it to work again. The YQL console's JSON output returned with a null "results" field. I eventually found out it was because of an encoding conflict. The HTTP header said the encoding was ascii while the page had as first line. Removing that line made both the console and the plugin get the page. I don't really like it since I have different encodings on different pages and I think some scripts will break if I change the coding server-side. I'll give it a try. Anyway, I wonder if that's a bug or a wanted new YQL behavior?
Thank you very much once again!

EDIT: I found how to set the encoding field in the HTTP header from my script. Now everything work just fine!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants