One data format that makes AJAX more effective is JSON.
Here's what it might look like:
Suppose we already have a function AJAX that uses the XMLHttp object to make an AJAX request to the specified page sending any data and then calling a callback function, passing it the server's response.
If the response text is encoded in JSON, we can simply make it into an object using the eval function:
Because it is so popular, many other programming languages have native functions to encode and decode JSON. PHP, for instance, has the json_encode and json_decode functions, which will return a string with the JSON equivalent of a passed object, and vice versa.
Be careful when applying the eval function to a string of unknown or untrusted origin. Hackers may try to inject malicious code into your page, and this is a massive security breach. I personally never use this function unless I wrote the script myself.
ZumGuy Network webmaster
Visit my Internet forum: ZumGuy Internet Forum
Translation by Transalpine Technical Translations.
Content © Renewable-Media.com. All rights reserved. Created : February 2, 2014 Last updated :February 14, 2016
The most recent article is:
View this item in the topic:
and many more articles in the subject:
Physics is the science of the very small and the very large. Learn about Isaac Newton, who gave us the laws of motion and optics, and Albert Einstein, who explained the relativity of all things, as well as catch up on all the latest news about Physics, on ScienceLibrary.info.
1883 - 1946
John Maynard Keynes was an English macroeconomist, whose ideas revolutionised modern economic thinking, and are still used as the basis of many western capitalist economies.
It is impossible to step twice into the same river.
Website © renewable-media.com | Designed by: Andrew Bone