Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Adding JSON feed on html page.

Featured Replies

I need to pass this JS object to the page, but not sure if I have to use a separate js file for it.

[{"firstname":"Bobby","lastname":"Fisher"},
{"firstname":"Charlton","lastname":"Wizard"},
{"firstname":"Anthony","lastname":"Lizard"},
{"firstname":"Mike","lastname":"Knight"}]

And this is the code I have to edit to upload it. http://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_ajax_getjson

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("button").click(function(){
        $.getJSON("demo_ajax_json.js", function(result){
            $.each(result, function(i, field){
                $("div").append(field + " ");
            });
        });
    });
});
</script>
</head>
<body>

<button>Get JSON data</button>

<div></div>

</body>
</html>

Not for 4 objects of this size. Shouldn't this be a JSON file though? I know the W3 Schools example loads in a .js file but if you're loading in a data structure then JSON is more suitable. It sounds like they don't know the difference given the file name.

I've said this plenty of times on here but W3Schools should be avoided. Why you'd want to use their tutorials when you have the likes of CodeSchool and FrontendMasters is beyond me.

  • Author

It's just what the company has asked me to use, I wouldn't use it normally.

What are they hoping to achieve here? In most cases of data retrieval and storage using a SQL database of some form is by far the better option.

 

As regards W3Schools they provide a useful basic primer just to get the drift and see how things actually work. The Try-it Editor function is really quite useful as you can edit and run the code again. I often sit here taking wild random guesses and running them just to see if they work or not. :)

 

As much of the content on W3Schools is actually scraped directly from MDN if you say that W3Schools is ****e and wrong then you are, by implication, saying MDN is ****e and wrong.

 

It's a useful 'get you started' resource and the site does state that code examples are only intended for demonstration purposes and are not really fit for full scale production work.

I've said this plenty of times on here but W3Schools should be avoided.

So what is actually wrong with this sort of content: http://www.w3schools.com/css/css_font.asp

 

For a noob it's a useful resource, and even for those with some knowledge of HTML/CSS it provides a useful set of resources. It's certainly easier for beginners to use for PHP functions than php.net. For example: this: http://www.w3schools.com/php/php_date.asp as compared to this: http://php.net/manual/en/function.date.php

 

I'm not saying it's better than other resources but for basic functionality it does the job pretty well.

As much of the content on W3Schools is actually scraped directly from MDN if you say that W3Schools is ****e and wrong then you are, by implication, saying MDN is ****e and wrong.

 

Where are you getting this information from?

 

MDN has been factually correct in literally everything I have referenced, whereas W3Schools is often wrong in it's descriptions and examples are often using bad practices, especially when it comes to JavaScript - just like in the example put up by the OP.

 

http://www.w3schools.com/json/

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON

 

The description by MDN is much, much clearer. and this statement by W3Schools is not correct:

 

W3Schools:

 

"The JSON format is syntactically identical to the code for creating JavaScript objects."

It is similar but NOT identical. JSON requires that keys be wrapped in double quotes, this is not the case in a JavaScript object.

 

as is explained by MDN:

 

 

MDN

It is based upon JavaScript syntax but is distinct from it: some JavaScript is not JSON, and some JSON is not JavaScript.

"Property names must be double-quoted strings; trailing commas are forbidden."

 

 

 

I can point out many more examples where W3Schools posts factually incorrect information. It's not a good resource for beginners not when you can compare with Treehouse, Codeschool even Code Academy is a better resource. You have MDN for (factually correct) referencing. The last thing you want to be giving beginners is false information and introducing bad coding practices. Bad habits are difficult to unlearn.

Edited by rbrtsmith

w3schools is definitely a good resource for noobs who are just learning as it has a easy ui and you see things work immediately, obviously wouldn't recommend it for amateurs or anyone above that level though. but w3schools is literally a dummys guide to understanding basics.

 

It wouldn't still on the top results on google today for the last near decade if people weren't actively benefiting from it

 

Taken from W3fools:

 

 

W3Schools still has issues but they have at least worked on the primary concern developers had. For many beginners, W3Schools has structured tutorials and playgrounds that offer a decent learning experience. However, it would be a mistake to continue your education without learning from more reputable sources, so when you're ready to level up, move on.

Edited by Samus

Whether or not it has a nice UI (it doesn't) is irrelevant if the information they provide is littered with errors. The listings on Google have nothing to do whether or not people find it useful.

 

There shouldn't even be a debate about something as clear cut as this. One of the best decisions I made early on was listened to the advice of well known experts who said to steer well clear of websites like W3schools.

Edited by rbrtsmith

I said much of the content not all of it. I'm not going to find specific pages but if you compare the pages on MDN on the HTML elements and the the corresponding pages on W3Schools you will find that the content is similar and in some cases identical. The same is true for many other pages.

 

I know that a couple of years ago much of the content on W3Schools was outdated and some actually erroneous which gave rise to W3Fools. However the site has since been overhauled and is now fairly decent as a quick reference and basic information source.

 

It states quite clearly on the site:

W3Schools is optimized for learning, testing, and training. Examples might be simplified to improve reading and basic understanding. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content.

 

 

MDN states:

Now and then, you may run into problems while using MDN. Whether it's a problem with site infrastructure or an error in documentation content,

 

 

On sites of the size of these, MDN is available for download as a 1.8GB tarball, and the amount of content contained in them it is always possible that there might be the odd error or mistake here and there. If you find one report it.

I've said this plenty of times on here but W3Schools should be avoided. Why you'd want to use their tutorials when you have the likes of CodeSchool and FrontendMasters is beyond me.

 

Maybe I'm missing something but where on those sites does it have a HTML/CSS reference where I can look up how to use <img src=''>?

 

There shouldn't even be a debate about something as clear cut as this. One of the best decisions I made early on was listened to the advice of well known experts who said to steer well clear of websites like W3schools.

 

But that's just you. My Dad doesn't want to go on a course, he just wants to know how to change padding or set a border. W3Schools can help him with that.

 

Maybe I'm missing something but where on those sites does it have a HTML/CSS reference where I can look up how to use <img src=''>?

 

 

But that's just you. My Dad doesn't want to go on a course, he just wants to know how to change padding or set a border. W3Schools can help him with that.

 

And the information your Dad or whomever uses it as a quick reference is likely to be false. I really can't believe we're even having this discussion on this - it's like debating the colour of the moon.

On what planet can a resource that publishes (A lot) of incorrect information be considered a resource even worth visiting, never mind good? Especially with an alternative like MDN.

For ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img

 

I've just shown this thread to some of my colleagues who are all senior or higher developers and they just shook their heads in disbelief. You'd get laughed out the room at any reputable dev environment if you tried telling them W3Schools isn't bad.

 

NFC212: There isn't a single article on W3Schools that even closely resembles that of MDN, you are talking nonsense, if you are that adamant that there is then show me and example to counter mine.

 

Edited by rbrtsmith

So what is false about this page: http://www.w3schools.com/tags/tag_img.asp

 

Why is the MDN page better for someone like my Dad? It doesn't even have an example on how to use the <img> until you get waaaaay down the page so he's going to be totally confused.

 

You are looking at these reference sites from a whole different perspective. If you don't want to use w3schools that fine. But it works as a basic reference resource for many people. People who aren't developers, aren't interested in js or jQuery or JSON or anything fancy. They just want to know how to change the colour of something. Even good old htmldog is easier to use than MDN.

Edited by fisicx

I really can't believe we're even having this discussion on this - it's like debating the colour of the moon.

 

On what planet can a resource that publishes (A lot) of incorrect information be considered a resource even worth visiting, never mind good? Especially with an alternative like MDN.

For ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img

 

I've just shown this thread to some of my colleagues who are all senior or higher developers and they just shook their heads in disbelief. You'd get laughed out the room at any reputable dev environment if you tried telling them W3Schools isn't bad.

 

NFC212: There isn't a single article on W3Schools that even closely resembles that of MDN, you are talking nonsense, if you are that adamant that there is then show me and example to counter mine.

 

 

Hmm, right.

 

What colour is the moon then? That might be a tad difficult so let's make it easier, what colour is the sea? Or even easier what colour is milk?

 

I haven't seen a lot of incorrect information on W3Schools recently. You seem to have some weird bee in you bonnet about the site. There were problems with it some years ago but most seem to have been rectified now.

 

W3Schools is not holy writ, it serves as a basic, quick reference for those getting into the world of web design and development. The only misinformation is your constant regurgitation that it is full of errors when it clearly isn't any more. One of the most cited resources on the web is Wikipedia yet that is riddled with errors, misinformation and often outright lies.

 

If you spot an error, report it to them and help make it a better resource. I found an issue on the MDN page for CSS Calc some time ago which wasn't an error as such but was somewhat ambiguous when you got further down the page. Reported it and it was fixed.

 

If you were teaching children to read what would you start them off with as a basic primer, Jack and Jill or The Brothers Karamazov.

The syntax has improved on the site, and they occasionally display warnings above code samples, but they still explain things in a confusing, and often incorrect way. For example:

JavaScript Scope
In JavaScript, objects and functions are also variables.


Objects are objects, functions are a function object. They aren't the same, and variables are not a primitive type.

What is an Array?
An array is a special variable, which can hold more than one value at a time.


There's the variable thing again, you don't even need to assign an array to a variable. There's also no mention of the fact JS doesn't have a primitive type for arrays, they're just objects with a new set of methods.

JavaScript Declarations are Hoisted
In JavaScript, a variable can be declared after it has been used.

In other words; a variable can be used before it has been declared.


Could they make this any more confusing? They mention later that declarations are moved to the top of the scope, but not why that happens.

Objects are variables too. But objects can contain many values.


This pattern of thinking in terms of variables goes on throughout the pages, and it's not an accurate way to describe what's going on. The user is going to be really confused when they learn that they can return an object or array from a function, without having to assign it to a variable. Or that they store an array inside an object without using a variable. The variable part becomes obsolete. It's actually easier to understand if you take them at face value as data structures and forget the variable thing altogether.

They don't even state on the functions page that functions can be return values, or passed into a function, which is one of the most powerful aspects of the language. They only mentioned that you can assign a function to a variable.

---
TL;DR - These tutorials give a false sense of what's actually happening, and will ultimately lead to confusion and a conflict in how things work if the user chooses to progress past these tutorials.

I can get past the wacky explanations, though. They just haven't explained something correctly or they've used the wrong metaphor to describe something, which happens I guess, but it's still careless for a site that makes a good income from advertising as well as other things.

 

The thing that bothers me is that they offer paid certifications based on information like this. Certifications that:

  • Are highly unlikely to be accepted by any company as a verified and trusted resource.
  • Are highly unlikely to ever land you a job or help you pass a technical interview.
  • Will knock someone's confidence, as a result of paying for information that hasn't got them to where they need to be.
  • Give a false sense of understanding and accomplishment.

The exam process is also a joke, you can take it online and just use Google to help you work through it. You can also re-take it again if you fail, and I doubt they have a large amount of questions. It's just a shameless money grab.

The problem with W3Schools is that it's a magnet for beginners, but fails to deliver quality materials. With all these small inaccuracies and bad coding practices, beginners simply fail to see them and won't not know any better for the future.

 

Their name also particularly annoys me, essentially piggybacking of the W3C and leading folk to believe they are affiliated.

 

And yes, their certifications are the most laughable thing about them. Basically just a $100 quiz.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.