jquery - When do I need to use JSON and XML? -


I know that there are so many sources that explain this, but they just keep adding the key / value to an array Talk about or in an object.

I do not understand why and when I should do it, though I always use jquery AJAX as an example, if I create a platform then I need it is? Can any real world give examples?

The same XML goes to store this information, but what kind of information? Why can not I store it in MySQL?

Edit: With $ .json () you can recover a JSON file and then display the content in the browser. But does Jason make this file? me? Manual? And why? And how?

So you can just get a JSON file? Both JSON and XML are used to store structured data basically. If your AJAX call only takes one value (like "number of votes"), then you can be it just bring it and do not use JSON or XML at all, but as soon as you get Needing to get values ​​(like "positive vote" and "negative vote"), you need some structure.

Both JSON and XML support nesting data (like a.b.c = X). JSON has the advantage of parsing in lightweight and very easy JS (as is basically, JSON JS is), which is why it is generally preferred on XML for AJAX applications.

Even a very simple "only one value" case, I recommend using JSON directly because it provides easy space for ease, while not a single value.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -