Source Code
Implemented at
Sync and
Async
This Code was the result of changing browser script from client to server. Cross domain requests were blocked by security when the page was served from a host site. The goal was to be able to get Wow Armory information, XML format, for multiple key values to determine the average item level of each character value. The script had to be served from a web host and accessed from common browser clients.
This solution targeted both PHP Version 5.2.13 and IIS .asp web servers. The supported browsers include Internet Explorer 8, Chrome, and Firefox.
The synchronous example from a button event waits for the result. The asynchronous example submits multiple requests and displays the results in a table.
There are three tiers of code. The browser client, the server Java script, and the cross domain bridge.
Before running the examples, copy
sync.html,
async.html,
xmlhttpx.js,
rcv_char.asp and
rcv_char.php to your web site.
Switch to .asp if .php is not supported by opening
xmlhttpx.js, change the AveClass()
"Rcvr" : "http://" + top.location.host + "/rcv_char.asp" and save it (default was .php).
Open with your browser, http:// your web site /sync.html.
The synchronous browser client code '
sync.html' includes the script '
xmlhttpx.js' to define the class '
AveClass()'. Then it’s a matter of providing the query arguments to the armory server and pressing the iLvl button. The result (Name Average Total/Number) is shown with an alert.
Open with your browser, http:// your web site /async.html.
The asynchronous browser client code '
async.html' includes the script '
xmlhttpx.js' to define the class '
AveClass()
'. A form table input boxes are used as the target of the results. The page is updated without a postback.
The middle tier script is used to cross domains,
rcv_char.asp or
rcv_char.php depending on the web server used.
I wrote this to learn how and borrowed ideas from everywhere. My wish list is adding SQL records containing the XML. With one real armory fetch each day.