JSORM.db.channel.http
From Jsorm
Overview
Channel to send update data to and receive load data from the server that actually sent the page, using Ajax. This is the only default channel currently shipping with jsormdb. However, you can easily use a memory channel, i.e. no loads from or updates to a remote data store, by passing no channel argument to the JSORM.db.db() constructor in the configuration object. Similarly, setting writeMode to JSORM.db.db.nothing will prevent any updates; loads, however, will still attempt to retrieve from the remote data source.
Usage
The http channel is configured at instantiation time with the URL of the remote server. It needs to be told about the URL to use for load and the one to use for update, if different. There is no reason you cannot use the same URL for both. The URL here is technically not a URL, as it is only the file path, but it is referred to as a URL nonetheless.
The constructor is passed a configuration object with as many of the following elements as desired:
- loadUrl: The URL to be used by the http channel to load data.
- updateUrl: The URL to be used by the http channel to send data.
- url: A single URL to be used to both send and load data, instead of separate loadUrl and updateUrl.
Note that if loadUrl or updateUrl is provided, it will always override plain url for that procedure, i.e. load or update.
// set up an http channel var config = { updateUrl: "/send/foo.php", loadUrl: "/receive/foo.xml" } var channel = JSORM.db.channel.http(config);
