The goog.net.Jsonp Class

goog.net.Jsonp(uri, opt_callbackParamName)

Creates a new cross domain channel that sends data to the specified host URL. By default, if no reply arrives within 5s, the channel assumes the call failed to complete successfully.

uri {goog.Uri|string}
The Uri of the server side code that receives data posted through this channel (e.g., "http://maps.google.com/maps/geo").
opt_callbackParamName {string=}
The parameter name that is used to specify the callback. Defaults to "callback".

.CALLBACKS

The name of the property of goog.global under which the callback is stored.

.cancel(request)

Cancels a given request. The request must be exactly the object returned by the send method.

request {Object}
The request object returned by the send method.

.getRequestTimeout()

Returns the current timeout value, in milliseconds.

returns {number}
The timeout value.

.send(opt_payload, opt_replyCallback, opt_errorCallback, opt_callbackParamValue)

Sends the given payload to the URL specified at the construction time. The reply is delivered to the given replyCallback. If the errorCallback is specified and the reply does not arrive within the timeout period set on this channel, the errorCallback is invoked with the original payload. If no reply callback is specified, then the response is expected to consist of calls to globally registered functions. No &callback= URL parameter will be sent in the request, and the script element will be cleaned up after the timeout.

opt_payload {Object=}
Name-value pairs. If given, these will be added as parameters to the supplied URI as GET parameters to the given server URI.
opt_replyCallback {Function=}
A function expecting one argument, called when the reply arrives, with the response data.
opt_errorCallback {Function=}
A function expecting one argument, called on timeout, with the payload (if given), otherwise null.
opt_callbackParamValue {string=}
Value to be used as the parameter value for the callback parameter (callbackParamName). To be used when the value needs to be fixed by the client for a particular request, to make use of the cached responses for the request. NOTE: If multiple requests are made with the same opt_callbackParamValue, only the last call will work whenever the response comes back.
returns {Object}
A request descriptor that may be used to cancel this transmission, or null, if the message may not be cancelled.

.setRequestTimeout(timeout)

Sets the length of time, in milliseconds, this channel is prepared to wait for for a request to complete. If the call is not competed within the set time span, it is assumed to have failed. To wait indefinitely for a request to complete set the timout to a negative number.

timeout {number}
The length of time before calls are interrupted.