See the dojo/io/script reference documentation for more information.




Defined by dojo/io/script

creates a new <script> tag pointing to the specified URL and adds it to the document.

Attaches the script element to the DOM. Use this method if you just want to attach a script to the DOM and do not care when or if it loads.

Parameter Type Description
id undefined
url undefined
frameDocument undefined


Defined by dojo/io/script

sends a get request using a dynamically created script tag.

Parameter Type Description
args Object

An object with the following properties:

  • callbackParamName (String):

    Deprecated as of Dojo 1.4 in favor of "jsonp", but still supported for legacy code. See notes for jsonp property.

  • jsonp (String):

    The URL parameter name that indicates the JSONP callback string. For instance, when using Yahoo JSONP calls it is normally, jsonp: "callback". For AOL JSONP calls it is normally jsonp: "c".

  • checkString (String):

    A string of JavaScript that when evaluated like so: "typeof(" + checkString + ") != 'undefined'" being true means that the script fetched has been loaded. Do not use this if doing a JSONP type of call (use callbackParamName instead).

  • frameDoc (Document):

    The Document object for a child iframe. If this is passed in, the script will be attached to that document. This can be helpful in some comet long-polling scenarios with Firefox and Opera.

  • load:

    This function will be called on a successful HTTP response code.

  • error:

    This function will be called when the request fails due to a network or server error, the url is invalid, etc. It will also be called if the load or handle callback throws an exception, unless djConfig.debugAtAllCosts is true. This allows deployed applications to continue to run even when a logic error happens in the callback, while making it easier to troubleshoot while in debug mode.

  • handle:

    This function will be called at the end of every request, whether or not an error occurs.

  • url (String):

    URL to server endpoint.

  • content (Object, optional):

    Contains properties with string values. These properties will be serialized as name1=value2 and passed in the request.

  • timeout (Integer, optional):

    Milliseconds to wait for the response. If this time passes, the then error callbacks are called.

  • form (DOMNode, optional):

    DOM node for a form. Used to extract the form values and send to the server.

  • preventCache (Boolean, optional):

    Default is false. If true, then a "dojo.preventCache" parameter is sent in the request with a value that changes with each request (timestamp). Useful only with GET-type requests.

  • handleAs (String, optional):

    Acceptable values depend on the type of IO transport (see specific IO calls for more information).

  • rawBody (String, optional):

    Sets the raw body for an HTTP request. If this is used, then the content property is ignored. This is mostly useful for HTTP methods that have a body to their requests, like PUT or POST. This property can be used instead of postData and putData for dojo/_base/xhr.rawXhrPost and dojo/_base/xhr.rawXhrPut respectively.

  • ioPublish (Boolean, optional):

    Set this explicitly to false to prevent publishing of topics related to IO operations. Otherwise, if djConfig.ioPublish is set to true, topics will be published via dojo/topic.publish() for different phases of an IO operation. See dojo/main.__IoPublish for a list of topics that are published.

Returns: undefined


Defined by dojo/io/script

removes the script element with the given id, from the given frameDocument. If no frameDocument is passed, the current document is used.

Parameter Type Description
id undefined
frameDocument undefined

© 2005–2017 JS Foundation
Licensed under the AFL 2.1 and BSD 3-Clause licenses.