General Interface is an open source project hosted by the Dojo Foundation

Sending Data

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:

  1. Create a new jsx3.net.Request instance.
  2. Call the open() method and specify the interaction type (GET, POST, and so on).
  3. Call the send() method.

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

Searching General Interface Docs

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.