Welcome! Our Tools - BpBrowser
- BpControl
- BpDownloadUrl
- BpLabel
- BpMarker
- BpMarkerLight
- BpMarkerList
- BpWindow
About Us Licensing Fees Support Contact Us

808-281-3359


BpDownloadUrl Reference

Introduction

Download

This is not a class; it's a function. It's meant to be a more fully-featured replacement to GDownloadUrl().
BpDownloadUrl() allows POST and synchronous requests.

There is no fee for commercial use of BpDownloadUrl.

BpDownloadUrl()

Code:
var request = BpDownloadUrl(url,handler,onError?,postArgs?,sync?)


Remarks:

url is the URL to request.
handler is the handler function. It takes two arguments: the responseText, and the request object.
onError is optional, and defaults to "There has been a server error." If it is a string, then that message will be alerted to the user on error. If it's a function, then that function will be called on error. It will be passed the request object as its only argument.
postArgs is optional. If it's an object or a string, then the method of the request will be POST. If it's a string, it will be sent as POST data. If it's an object, BpDownloadUrl.serialize() will be used to transform it into POST data.
sync is optional. If present and true, the request will be made synchronously. This means that when BpDownloadUrl() returns, it will return a completed request object.
Examples:

BpDownloadUrl.create()

Code:
var request = BpDownloadUrl.create()


Remarks:

This is the same thing as GXmlHttp.create(). It's been reworked this way so as not to require the Google Maps API.

BpDownloadUrl.serialize()

Code:
var postData = BpDownloadUrl.serialize(obj)


Remarks:

This is the class method which transforms an object to POST data for BpDownloadUrl().

The transformation will take the properties of the object and convert them into a string. If the object contains any arrays, they will be converted to query-string data so that a PHP script will load the data properly. A parameter name will be created by appending "[]" to the object's property name. Then the items in the array will each be added to the query-string using that name. Nested objects and arrays will not be converted.