Update Content

Syntax

$.putContent = function (url, chg, newUrl)

Arguments

Description

Loads data from the Server into the Page Container by sending an HTTPPUT request to the action of the URI specified in “url”. It should be used when the action of the URI updates data from the database.

If parameter “chg” is set to true, the current URI gets changed into the URI specified in “newURL”. If argument “chg” is set to true and argument “newUrl” is empty, then the URI gets changed into the URI specified in “url”.

If the URI that is specified in “newURL” does not exist or contains a spelling error, the function will still treat it as valid URI and load the page but an error message from the browser will likely follow.

Examples

Example 1: Updating content without changing URL in address bar

The following program illustrates the function call with only one parameter:

$.putContent("main/update/" + 1234);

It will send a request to “main/update” along with the parameter of the action set to 1234 (specifying the data to be updated) and load the response into the Page Container replacing the content that is currently displayed. The URI in the address bar stays the same.

Example 2: Updating content with changing URL in address bar

The following program illustrates the function call with second parameter set to true:

$.putContent("main/update/" + 1234, true, "main/page" );

It will send a request to “main/update” along with the parameter of the action set to 1234 (specifying the data to be updated) and load the response to Page Container replacing the content that is currently displayed. The URI that is currently displayed in the address bar gets replaced by “main/page”.

Last updated