Class bbq.ajax.MockAJAXRequest

Defined in: MockAJAXRequest.js.
bbq.ajax.MockAJAXRequest

For use while testing classes that make AJAX requests to a remote server. For example, if you are testing a bit of code that includes the following:

new bbq.ajax.JSONRequest({
    url: "/foo/bar",
    args: {
         bar: "baz"
    },
    onSuccess: function(serverResponse, json) {
         alert("server said: " + json.baz);
    }
});

To handle this sort of request, you'd do the following before the AJAX call is invoked:

bbq.ajax.MockAJAXRequest["/foo/bar"] = function(args) {
     return new bbq.ajax.MockJSONResponse({response: {
         baz: "qux"
     }});
}

This will result in the onSuccess handler being called immediately.

Class Summary
Constructor Attributes Constructor Name and Description
 
For use while testing classes that make AJAX requests to a remote server.

Constructor Detail

bbq.ajax.MockAJAXRequest()