User Tools

Site Tools


tutorials:zencartmods:daily_ajax.html

This is an old revision of the document!


AJAXify your Daily stats

Last week, we created a daily stats page. If you're like us, then you compulsively click refresh on this page way too often! So lets AJAX-ify this page so that it updates automatically every time someone makes an order.

Get jQuery

We're going to use jQuery for this page. jQuery\ isn't necessary for AJAX, you could just use plain javascript as well, but jQuery makes things much easier in general.

You can either download jQuery and host it on your own server, or use a CDN like Google or Microsoft. We use Google's CDN.

If you're hosting it on your own server, then add to the <head> section of daily stats

<script src="https://you.path/to.jquery.js"></script>

or if you're using a CDN (this one is Google) then use

<script type="text/javascript" src="https://www.google.com/jsapi?key=YOUR_API_KEY"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>

you have to replace YOUR_API_KEY with the API key you've obtained from Google.

/home/ladyada/public_html/wiki/data/attic/tutorials/zencartmods/daily_ajax.html.1308756117.txt.gz · Last modified: 2016/01/28 18:05 (external edit)