Class that handles raw server connections. It handles HTTP requests to server and server responses.
It is also responsible to inform user about connection status.
Class that handles raw server connections. | |
Opens up a HTTP channel to target, sending data using GET or POST methods and sets up a handler to manipulate server response | |
Sets up the Content-type HTTP header attribute that will be sent to server when a new request is made | |
Cancel the request specified by ID | |
When creating a request, one can specify what message should be shown on the various possible states of the connection. | |
Specifies a location in the document where the status messages should be shown. | |
Sets the visibility of the messages. | |
Internal method used to update status messages |
p.newRequest = function ( id, target, data, handler, method )
Opens up a HTTP channel to target, sending data using GET or POST methods and sets up a handler to manipulate server response
id | The ID of the request. This is used to avoid double calls and show the appropriate message in the appropriate place |
target | The target URL |
data | The string to be sent |
handler | A function that will be called when server response arrives. This function will be called with the response from server passed as argument. |
method | How data should be passed to server. Valid values are ‘POST’ and ‘GET’. Defaults to POST |
p.setProgressContent = function ( id, state, content )
When creating a request, one can specify what message should be shown on the various possible states of the connection. This method is used to do so.
id | The ID of the request |
state | The state that this message should be shown |
content | The content of the message |
Opens up a HTTP channel to target, sending data using GET or POST methods and sets up a handler to manipulate server response
p.newRequest = function ( id, target, data, handler, method )
Sets up the Content-type HTTP header attribute that will be sent to server when a new request is made
p.setContentType = function( type )
Cancel the request specified by ID
p.cancelRequest = function ( id )
When creating a request, one can specify what message should be shown on the various possible states of the connection.
p.setProgressContent = function ( id, state, content )
Specifies a location in the document where the status messages should be shown.
p.setProgressHolder = function ( id, holder )
Sets the visibility of the messages.
p.setVisible = function ( visible )
Internal method used to update status messages
p._setProgressState = function ( id, state )