Ajax Notes

From Federal Burro of Information
Jump to navigationJump to search

Ready State Go!

State   Description
0       The request is not initialized
1       The request has been set up
2       The request has been sent
3       The request is in process
4       The request is comple

http://www.w3schools.com/Ajax/ajax_xmlhttprequest.asp

Eve-tool Notes

http://www.quadratic.net/eve-tool/

Eve-tool is an ajax site.

  • the main page has a bunch of empty html spans, and it includes file with java script in them ( showX.js ).
  • the main page has the form controls in it that trigger the javascripts:
onClick="javascript:showX(this.form)"
onKeyup="javascript:showY(this.form)"
and so on.
  • Each javascript include has two functions:
showX (form) { ... }
XStateChange () { ... }
    • showX constructs an GetXmlHttpObject fills it with the correct url and aruments and sets XStateChange as the call back for the completed request.
    • XStateChange fills t he span tag with the result.
  • Note that "the correct url" is a simple php script that takes arguments and returns html. Typically in proper web app developement an XML request is sent and an XML response is received. The client translates the xml into html with some xsl. That's a bit too fancy for me for now. Stay tuned I might tighten it up yet.
  • I do the XML method at my work places. The xml method allwos you to expose you interface to other's not jsut the web app you are working on.

I think I need a demonstration:

so you search for dominix and javascript:showHint is executed with your search string "dominix" . The request the server sees is:

GET /eve-tool/search_items_by_name.php?q=dom
GET /eve-tool/search_items_by_name.php?q=domi
GET /eve-tool/search_items_by_name.php?q=domin
GET /eve-tool/search_items_by_name.php?q=domini
GET /eve-tool/search_items_by_name.php?q=dominix

( try it : http://www.quadratic.net/eve-tool/search_items_by_name.php?q=dominix ) all that comes back is some html.

Notice that the links (which execute itemdispatch ) don't work out of context. In the web page they get the refine data, the variations and the market data ( if I could get that market data crap working).

Also See