LoadScript()

Syntax

LoadScript(URL$, Callback [, Type])
Description
Load a JavaScript script (.js) into the app

Parameters

URL$ The URL of the javascript to load.
Callback The callback called once the loading has finished. If the loading is successful, the 'Success' callback parameter will be set to #True, if not it will be set to #False. It has to use the following syntax:
Type (optional) Can be one of the following values:
  #PB_Script_JavaScript: the script to load is a JavaScript (default)
  #PB_Script_CSS: the script to load is a CSS
  Procedure Callback(URL$, Success)
    ; Code here
  EndProcedure

Return value

None.

Example: Loading a JavaScript

  Procedure Main(URL$, Success)
    Debug "Script URL: " + URL$
    Debug "Loading status: " + Success
  EndProcedure

  LoadScript("https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-alpha.3/js/materialize.min.js", @Main())

Example: Loading a CSS

  Procedure Main(URL$, Success)
    Debug "Script URL: " + URL$
    Debug "Loading status: " + Success
  EndProcedure

  LoadScript("http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css", @Main(), #PB_Script_CSS)

Supported OS

All

<- ElapsedMilliseconds() - System Index - LoadStyle() ->