I’m working on getting my javascript experience up a notch.
I’ve got the basic Idea of what I want to do.
I want to make an automated javascript that calls to a php page.
This php page would generate an array with new notifications for it to display.
Now I need a push into the right direction, maybe some existing script to start with.
I’ve been digging arround in jquery and prototype for ajax solutions but don’t get much further.
My main questions:
How can I pull data from another page or file anyways?
In what format should the data be supplied?
Is there an existing script that I could start of?
Anyways, Thanks for your time!
Have a look at jQuery, it has a lot of features that you could also use in the future of your site.
using jQuery:
non JSON approch
the 1st param would be the file you want to load, or get the context from,
secondly we pass in a function that would alert that the data was loaded, you can easily change this function to do what you want and display the data that was returned.
Query also offer a lot of documentation so whenever you’re stuck just take a look at:
http://api.jquery.com/jQuery.getJSON/
http://api.jquery.com/category/ajax/
I would suggest JSON, just because it works so easily and isn’t as bloated as other structures. if you haven’t worked with JSON before, checkout: http://www.json.org/js.html
but a simple JSON structure would be:
jQuery should be more than enough: http://jquery.com/