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

Changed query and added tip for environment #640

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion page/ajax/working-with-jsonp.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ $.ajax({

// Tell YQL what we want and that we want JSON
data: {
q: "select title,abstract,url from search.news where query=\"cat\"",
q: "select * from search.ec (1, 10) WHERE keyword='New York'",
format: "json"
},

Expand All @@ -31,4 +31,6 @@ $.ajax({
});
```

If you'd like to access community tables you have to add `env: "http://datatables.org/alltables.env"` to the data object otherwise you would get an error message with `No definition found for Table`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't really have a strong markdown style guide, but could you add a blank line right after the end of the code snippet? It's consistent with the other markdown.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there some way we can not go through this all and keep it simple instead? I can imagine this is already too complicated for many less-experienced people.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think YQL is pretty complicated for beginners but the tip for the community tables is helpful. Because then you can do requests to Google, Github etc.
Maybe a simpler JSONP example would help. But I have not found many good json resources. I've found wikipedia (also not easy to do requests) or http://date.jsontest.com/ for timestamp request (that's easy).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't the first time we're in need of a good, fake API to demonstrate Ajax to people (#475 for example). I'm going to drop it on the meeting notes so the team can brainstorm about it.

I just feel like this might already be too complicated for some people, plus, people are here to learn about jQuery - not about the way YQL works.


jQuery handles all the complex aspects of JSONP behind-the-scenes — all we have to do is tell jQuery the name of the JSONP callback parameter specified by YQL ("callback" in this case), and otherwise the whole process looks and feels like a normal Ajax request.