Re: Any simple examples of ajax use in module?
Bill,
http://resurrectionwebdesign.com/miva/test.html
Have a look at that. I fixed the issues.
First, you have to make an AJAX call in order to get the data from the script.
Second, don't rely on document.write. This works as the DOM is being rendered, and this is NOT what you want. You'll end up running into issues because of it. Especially if you're on a server that might be a bit laggy sometimes. Use intervals, timeouts, or other events if need be.
Third, the reason the hardcoded version worked was because it was present in the DOM. That's why the document.write was writing what you wanted.
If you look at the JS I provided, you'll see the most basic AJAX call in the world. It parses the JSON string and shows it in the 'pre' element, and it puts the mydata[5] in a span.
Hope that helps!
Originally posted by wcw
View Post
http://resurrectionwebdesign.com/miva/test.html
Have a look at that. I fixed the issues.
First, you have to make an AJAX call in order to get the data from the script.
Second, don't rely on document.write. This works as the DOM is being rendered, and this is NOT what you want. You'll end up running into issues because of it. Especially if you're on a server that might be a bit laggy sometimes. Use intervals, timeouts, or other events if need be.
Third, the reason the hardcoded version worked was because it was present in the DOM. That's why the document.write was writing what you wanted.
If you look at the JS I provided, you'll see the most basic AJAX call in the world. It parses the JSON string and shows it in the 'pre' element, and it puts the mydata[5] in a span.
Hope that helps!
Comment