~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/media/tutorial/tutorial.js

  • Committer: mattgiuca
  • Date: 2008-02-25 00:02:33 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:559
Major JavaScript refactor: util.ajax_call is now asynchronous, not
    synchronous.
    This required a change to the interface - now takes a callback and calls
    that, instead of waiting to return.
console.js, browser.js, tutorial.js, tos.js (all users of ajax_call):
    Reworked how they call - all calls now create a callback
    continuationy-thing, and pass that to ajax_call.

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
 
68
68
    /* Send the form as multipart/form-data, since we are sending a whole lump
69
69
     * of Python code, it should be treated like a file upload. */
70
 
    var xhr = ajax_call("tutorialservice", "", args, "POST",
 
70
    /* AJAX callback function */
 
71
    var callback = function(xhr)
 
72
        {
 
73
            var testresponse = JSON.parse(xhr.responseText);
 
74
            handle_testresponse(exercisediv, testresponse);
 
75
        }
 
76
    ajax_call(callback, "tutorialservice", "", args, "POST",
71
77
        "multipart/form-data");
72
 
    var testresponse = JSON.parse(xhr.responseText);
73
 
    handle_testresponse(exercisediv, testresponse);
74
78
}
75
79
 
76
80
/** Given a exercise div, return the testoutput div which is its child.