Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This function posts data to a new browser window.

Parameters

...

  • url – the url URL to which the data will be posted
  • parm1 (optional) – the first parameter’s name name 
  • value1 (Optionaloptional)value1 –  – the first parameter’s value value 
  • parm2 (Optionaloptional)parm2 –  – the second parameter’s name name 
  • value2 (Optionaloptional)value2 –  – the second parameter’s value (Optional)value 

Example

...

In this example, we have a tracking number for shipments in an order maintenance application. We are posting this tracking number to the UPS tracking website once the tracking button on the screen is clicked.

// get the button
Code Block
languagejavascriptjavascript
js
titlePost Tracking Number to UPS Tracking Website
// Get the button object to work with. 
// "TrackingButton" is the value of the `id` attribute of the target button.
var trackButton = getObj ("'TrackingButton"');

// assignAssign the onclick event to the retrieved button so that it posts object.
trackButton.onclick =
  // Event handler function to post data to UPS tracking trackButtonwebsite.onclick
 = function (event) {
     // Set setvariable to the urldestination URL.
    var url = "'http://www.ups.com/tracking/tracking.html"';


    // Set setvariable to the parameter and its value_name_.
     var param1 = "'trackNums";
     ';

    // Set variable to the parameter _value_.
    var trackingNum = get ("'I_6_20"');


    // Post postdata to UPS tracking tracking website.
    postToNewWindow (url, param1, trackingNum);
  }
;