Home

# Class goog.net.Jsonp

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.

Instance Method Summary
| `cancel(?Object request)` Cancels a given request. The request must be exactly the object returned by the send method.
| `getRequestTimeout() ⇒ number` Returns the current timeout value, in milliseconds.

`send(?Object= opt_payload, ?Function= opt_replyCallback, ?Function= opt_errorCallback, string= opt_callbackParamValue) ⇒ ?Object`

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.

| `setRequestTimeout(number 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.

Static Method Summary
| `addPayloadToUri_(!Object payload, !goog.Uri uri) ⇒ !goog.Uri` Returns URL encoded payload. The payload should be a map of name-value pairs, in the form {"foo": 1, "bar": true, ...}. If the map is empty, the URI will be unchanged. The method uses hasOwnProperty() to assure the properties are on the object, not on its prototype.
| `cleanup_(string id, boolean deleteReplyHandler)` Removes the script node and reply handler with the given id.
| `newErrorHandler_(string id, ?Object payload, ?Function= opt_errorCallback) ⇒ !Function` Creates a timeout callback that calls the given timeoutCallback with the original payload.
| `newReplyHandler_(string id, ?Function replyCallback) ⇒ ?Function` Creates a reply callback that calls the given replyCallback with data returned by the server.