You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
kmussel edited this page Dec 15, 2010
·
4 revisions
CoreJS offers Http request using an object for handling one Http instance at a time, and offers several global, simplified methods for working with request. CoreJS also offers the ability to have callbacks to make the request asynchronous. To make a request asynchronous you simply add a callback function as the last argument.
Global Methods:
// Making a Post Request:varcontent=Http.post("/path/to/file",{firstArgument:"someData",secondArgument:"moreData"});ORAsynchronouslyHttp.post("/path/to/file",{arg:"arg1",arg2:"arg2"},function(data){print(data);});// Making a Get RequestSameformataspostbutuseHttp.get()instead.
Http Object usage:
Currently the Http object doesn't do anything more than using the global Http object. But in the future this will allow us to keep an instance of it should we choose to add more data that we want to keep a reference to.
// Create a new Http object:varhttpClient=newHttpClient();//Uses the same format as the global method except instead of Http we use our instance of the classhttpClient.post();httpClient.get();