JavaScript Engine: XMLHTTPRequest Example

Note: This topic applies to Web - HTTP/HTML Vuser scripts written in C only.

VuGen's JavaScript Engine enables you to include JavaScript code in a Vuser script. For details on the JavaScript Engine, see Using the VuGen JavaScript Engine.

The example below shows how you can use a JavaScript XMLHTTPRequest object in a Web(HTTP/HTML) Vuser script. In this example, the XMLHTTPRequest object enables the Vuser to download a stock quote from, and then to save the value to a parameter for future use.

The script section below shows a web_js_run function that has been inserted into a Vuser script. The web_js_run function includes a reference to a file called XMLHTTPRequest_sync_sample.js. This file contains the JavaScript code that executes the XMLHTTPRequest function.

The contents of the XMLHTTPRequest_sync_sample.js file are shown below.

  • For additional examples of code used with the JavaScript Engine, see the Function Reference.
  • For information about the XMLHTTPRequest object, see
Back to top
Got it!
Welcome to the help center for LoadRunner Professional, formerly known as LoadRunner. LoadRunner Professional is part of the new Micro Focus LoadRunner family of performance testing products.