You can send data from an application using the methods: GET or POST. Depending upon the capabilities of the server being called, other methods like DELETE, PUT, and HEAD may also be called. The following describes the general pattern for sending data:
For a POST interaction, pass the string content as the only parameter to the send() method. For GET, use another content mechanism, such as an overloaded URL, as in this example: //initialize and open var req = jsx3.net.Request.open("GET","http://www.tibco.com?myQuery=1", true); //create response callback and subscribe function onResponse(objEvent) { var req = objEvent.target; alert(req.getResponseText()); }; req.subscribe(jsx3.net.Request.EVENT_ON_RESPONSE,onResponse); //send req.send(); General Interface applications perform best when they use asynchronous data access. However, there are times when you might want to synchronously access data. The above call made synchronously is shown in the following example: //initialize and open var req = jsx3.net.Request.open("GET","http://www.tibco.com?myQuery=1", false); //send req.send(); alert(req.getResponseText()); |
Contents
|
