Warning: Use of undefined constant Symbol - assumed 'Symbol' (this will throw an Error in a future version of PHP) in /mnt/new-ebs/workbench-106550/lib/dojo/util/docscripts/lib/parser2/dojo2.inc on line 215 Warning: Use of undefined constant JavaScriptSymbol - assumed 'JavaScriptSymbol' (this will throw an Error in a future version of PHP) in /mnt/new-ebs/workbench-106550/lib/dojo/util/docscripts/lib/parser2/dojo2.inc on line 215

dojo/_base/xhr.js

  • Provides:

    • dojo._base.xhr
  • Requires:

    • dojo.lib.kernel in common
    • dojo._base.Deferred in common
    • dojo._base.json in common
    • dojo._base.lang in common
    • dojo._base.query in common
  • dojo.__XhrArgs

    • type
      Function
    • chains:
      • dojo.__IoArgs: (prototype)
      • dojo.__IoArgs: (call)
    • summary
      In addition to the properties listed for the dojo._IoArgs type,
      the following properties are allowed for dojo.xhr* methods.
  • dojo.__XhrArgs.constructor

    • constructor - constructor
    • type
      Function
    • summary
      In addition to the properties listed for the dojo._IoArgs type,
      the following properties are allowed for dojo.xhr* methods.
  • dojo.__XhrArgs.handleAs

    • optional
    • type
      String
    • summary
      Acceptable values are: text (default), json, json-comment-optional,
      json-comment-filtered, javascript, xml. See <code>dojo.contentHandlers</code>
  • dojo.__XhrArgs.sync

    • optional
    • type
      Boolean
    • summary
      false is default. Indicates whether the request should
      be a synchronous (blocking) request.
  • dojo.__XhrArgs.headers

    • optional
    • type
      Object
    • summary
      Additional HTTP headers to send in the request.
  • dojo.__XhrArgs.failOk

    • optional
    • type
      Boolean
    • summary
      false is default. Indicates whether a request should be
      allowed to fail (and therefore no console error message in
      the event of a failure)
  • dojo

    • alias - dojo
  • dojo.config

    • alias - dojo.config
  • dojo.fieldToObject

    • parameters:
      • inputNode: (typeof DOMNode||String)
    • returns
      Object
    • summary
      Serialize a form field to a JavaScript object.
    • description
      Returns the value encoded in a form field as
      as a string or an array of strings. Disabled form elements
      and unchecked radio and checkboxes are skipped.	Multi-select
      elements are returned as an array of string values.
    • type
      Function
  • dojo.formToObject

    • parameters:
      • formNode: (typeof DOMNode||String)
    • returns
      Object
    • summary
      Serialize a form node to a JavaScript object.
    • description
      Returns the values encoded in an HTML form as
      string properties in an object which it then returns. Disabled form
      elements, buttons, and other non-value form elements are skipped.
      Multi-select elements are returned as an array of string values.
    • example
      This form:
      	<form id="test_form">
      		<input type="text" name="blah" value="blah">
      		<input type="text" name="no_value" value="blah" disabled>
      		<input type="button" name="no_value2" value="blah">
      		<select type="select" multiple name="multi" size="5">
      			<option value="blah">blah</option>
      			<option value="thud" selected>thud</option>
      			<option value="thonk" selected>thonk</option>
      		</select>
      	</form>
      
      yields this object structure as the result of a call to
      formToObject():
      
      	{
      		blah: "blah",
      		multi: [
      			"thud",
      			"thonk"
      		]
      	};
    • type
      Function
  • dojo.objectToQuery

    • parameters:
      • map: (typeof Object)
    • returns
      String
    • summary
      takes a name/value mapping object and returns a string representing
      a URL-encoded version of that object.
    • example
      this object:
      
      	{
      		blah: "blah",
      		multi: [
      			"thud",
      			"thonk"
      		]
      	};
      
      yields the following query string:
      
      	"blah=blah&multi=thud&multi=thonk"
    • type
      Function
  • dojo.formToQuery

    • parameters:
      • formNode: (typeof DOMNode||String)
    • returns
      String
    • summary
      Returns a URL-encoded string representing the form passed as either a
      node or string ID identifying the form to serialize
    • type
      Function
  • dojo.formToJson

    • parameters:
      • formNode: (typeof DOMNode||String)
      • prettyPrint: (typeof Boolean)
    • returns
      String
    • summary
      Create a serialized JSON string from a form node or string
      ID identifying the form to serialize
    • type
      Function
  • dojo.queryToObject

    • parameters:
      • str: (typeof String)
    • returns
      Object
    • summary
      Create an object representing a de-serialized query section of a
      URL. Query keys with multiple values are returned in an array.
    • example
      This string:
      
      		"foo=bar&foo=baz&thinger=%20spaces%20=blah&zonk=blarg&"
      
      results in this object structure:
      
      		{
      			foo: [ "bar", "baz" ],
      			thinger: " spaces =blah",
      			zonk: "blarg"
      		}
      
      Note that spaces and other urlencoded entities are correctly
      handled.
    • type
      Function
  • dojo._blockAsync

    • type
      bool
  • dojo._contentHandlers

    • type
      Object
  • dojo.contentHandlers

    • summary
      A map of availble XHR transport handle types. Name matches the
      <code>handleAs</code> attribute passed to XHR calls.
    • description
      A map of availble XHR transport handle types. Name matches the
      `handleAs` attribute passed to XHR calls. Each contentHandler is
      called, passing the xhr object for manipulation. The return value
      from the contentHandler will be passed to the `load` or `handle`
      functions defined in the original xhr call.
    • example
      Creating a custom content-handler:
      	dojo.contentHandlers.makeCaps = function(xhr){
      		return xhr.responseText.toUpperCase();
      	}
      	// and later:
      	dojo.xhrGet({
      		url:"foo.txt",
      		handleAs:"makeCaps",
      		load: function(data){ /* data is a toUpper version of foo.txt */ }
      	});
    • type
      Object
  • dojo.contentHandlers.text

    • parameters:
      • xhr
    • summary
      A contentHandler which simply returns the plaintext response data
    • type
      Function
  • dojo.contentHandlers.json

    • parameters:
      • xhr
    • summary
      A contentHandler which returns a JavaScript object created from the response data
    • type
      Function
  • dojo.contentHandlers.json-comment-filtered

    • parameters:
      • xhr
    • summary
      A contentHandler which expects comment-filtered JSON.
    • description
      A contentHandler which expects comment-filtered JSON.
      the json-comment-filtered option was implemented to prevent
      "JavaScript Hijacking", but it is less secure than standard JSON. Use
      standard JSON instead. JSON prefixing can be used to subvert hijacking.
      
      Will throw a notice suggesting to use application/json mimetype, as
      json-commenting can introduce security issues. To decrease the chances of hijacking,
      use the standard `json` contentHandler, and prefix your "JSON" with: {}&&
      
      use djConfig.useCommentedJson = true to turn off the notice
    • type
      Function
  • dojo.contentHandlers.javascript

    • parameters:
      • xhr
    • summary
      A contentHandler which evaluates the response data, expecting it to be valid JavaScript
    • type
      Function
  • dojo.contentHandlers.xml

    • parameters:
      • xhr
    • returns
      DOMDocument
    • summary
      A contentHandler returning an XML Document parsed from the response data
    • type
      Function
  • dojo.contentHandlers.json-comment-optional

    • parameters:
      • xhr
    • summary
      A contentHandler which checks the presence of comment-filtered JSON and
      alternates between the <code>json</code> and <code>json-comment-filtered</code> contentHandlers.
    • type
      Function
  • dojo.__IoArgs

    • type
      Function
  • dojo.__IoArgs.url

    • type
      String
    • summary
      URL to server endpoint.
  • dojo.__IoArgs.content

    • optional
    • type
      Object
    • summary
      Contains properties with string values. These
      properties will be serialized as name1=value2 and
      passed in the request.
  • dojo.__IoArgs.timeout

    • optional
    • type
      Integer
    • summary
      Milliseconds to wait for the response. If this time
      passes, the then error callbacks are called.
  • dojo.__IoArgs.form

    • optional
    • type
      DOMNode
    • summary
      DOM node for a form. Used to extract the form values
      and send to the server.
  • dojo.__IoArgs.preventCache

    • optional
    • type
      Boolean
    • summary
      Default is false. If true, then a
      &quot;dojo.preventCache&quot; parameter is sent in the request
      with a value that changes with each request
      (timestamp). Useful only with GET-type requests.
  • dojo.__IoArgs.handleAs

    • optional
    • type
      String
    • summary
      Acceptable values depend on the type of IO
      transport (see specific IO calls for more information).
      rawBody: String?
      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.rawXhrPost and dojo.rawXhrPut respectively.
  • dojo.__IoArgs.ioPublish

    • optional
    • type
      Boolean
    • summary
      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.publish for different phases of an IO operation.
      See dojo.__IoPublish for a list of topics that are published.
  • dojo.__IoArgs.load

    • parameters:
      • response: (typeof Object)
        The response in the format as defined with handleAs.
      • ioArgs: (typeof dojo.__IoCallbackArgs)
        Provides additional information about the request.
    • optional
    • type
      Function
    • summary
      This function will be
      called on a successful HTTP response code.
  • dojo.__IoArgs.error

    • parameters:
      • response: (typeof Object)
        The response in the format as defined with handleAs.
      • ioArgs: (typeof dojo.__IoCallbackArgs)
        Provides additional information about the request.
    • optional
    • type
      Function
    • summary
      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.
  • dojo.__IoArgs.handle

    • parameters:
      • loadOrError: (typeof String)
        Provides a string that tells you whether this function
        was called because of success (load) or failure (error).
      • response: (typeof Object)
        The response in the format as defined with handleAs.
      • ioArgs: (typeof dojo.__IoCallbackArgs)
        Provides additional information about the request.
    • optional
    • type
      Function
    • summary
      This function will
      be called at the end of every request, whether or not an error occurs.
  • dojo.__IoCallbackArgs

    • parameters:
      • args: (typeof Object)
        the original object argument to the IO call.
      • xhr: (typeof XMLHttpRequest)
        For XMLHttpRequest calls only, the
        XMLHttpRequest object that was used for the
        request.
      • url: (typeof String)
        The final URL used for the call. Many times it
        will be different than the original args.url
        value.
      • query: (typeof String)
        For non-GET requests, the
        name1=value1&amp;name2=value2 parameters sent up in
        the request.
      • handleAs: (typeof String)
        The final indicator on how the response will be
        handled.
      • id: (typeof String)
        For dojo.io.script calls only, the internal
        script ID used for the request.
      • canDelete: (typeof Boolean)
        For dojo.io.script calls only, indicates
        whether the script tag that represents the
        request can be deleted after callbacks have
        been called. Used internally to know when
        cleanup can happen on JSONP-type requests.
      • json: (typeof Object)
        For dojo.io.script calls only: holds the JSON
        response for JSONP-type requests. Used
        internally to hold on to the JSON responses.
        You should not need to access it directly --
        the same object should be passed to the success
        callbacks directly.
    • type
      Function
  • dojo.__IoCallbackArgs.args

    • type
      Object
    • summary
      the original object argument to the IO call.
  • dojo.__IoCallbackArgs.xhr

    • type
      XMLHttpRequest
    • summary
      For XMLHttpRequest calls only, the
      XMLHttpRequest object that was used for the
      request.
  • dojo.__IoCallbackArgs.url

    • type
      String
    • summary
      The final URL used for the call. Many times it
      will be different than the original args.url
      value.
  • dojo.__IoCallbackArgs.query

    • type
      String
    • summary
      For non-GET requests, the
      name1=value1&amp;name2=value2 parameters sent up in
      the request.
  • dojo.__IoCallbackArgs.handleAs

    • type
      String
    • summary
      The final indicator on how the response will be
      handled.
  • dojo.__IoCallbackArgs.id

    • type
      String
    • summary
      For dojo.io.script calls only, the internal
      script ID used for the request.
  • dojo.__IoCallbackArgs.canDelete

    • type
      Boolean
    • summary
      For dojo.io.script calls only, indicates
      whether the script tag that represents the
      request can be deleted after callbacks have
      been called. Used internally to know when
      cleanup can happen on JSONP-type requests.
  • dojo.__IoCallbackArgs.json

    • type
      Object
    • summary
      For dojo.io.script calls only: holds the JSON
      response for JSONP-type requests. Used
      internally to hold on to the JSON responses.
      You should not need to access it directly --
      the same object should be passed to the success
      callbacks directly.
  • dojo.__IoPublish

    • summary
      This is a list of IO topics that can be published
      if djConfig.ioPublish is set to true. IO topics can be
      published for any Input/Output, network operation. So,
      dojo.xhr, dojo.io.script and dojo.io.iframe can all
      trigger these topics to be published.
    • type
      Function
  • dojo.__IoPublish.start

    • type
      String
    • summary
      &quot;/dojo/io/start&quot; is sent when there are no outstanding IO
      requests, and a new IO request is started. No arguments
      are passed with this topic.
  • dojo.__IoPublish.send

    • type
      String
    • summary
      &quot;/dojo/io/send&quot; is sent whenever a new IO request is started.
      It passes the dojo.Deferred for the request with the topic.
  • dojo.__IoPublish.load

    • type
      String
    • summary
      &quot;/dojo/io/load&quot; is sent whenever an IO request has loaded
      successfully. It passes the response and the dojo.Deferred
      for the request with the topic.
  • dojo.__IoPublish.error

    • type
      String
    • summary
      &quot;/dojo/io/error&quot; is sent whenever an IO request has errored.
      It passes the error and the dojo.Deferred
      for the request with the topic.
  • dojo.__IoPublish.done

    • type
      String
    • summary
      &quot;/dojo/io/done&quot; is sent whenever an IO request has completed,
      either by loading or by erroring. It passes the error and
      the dojo.Deferred for the request with the topic.
  • dojo.__IoPublish.stop

    • type
      String
    • summary
      &quot;/dojo/io/stop&quot; is sent when all outstanding IO requests have
      finished. No arguments are passed with this topic.
  • dojo._ioSetArgs

    • parameters:
      • args: (typeof dojo.__IoArgs)
        The args object passed into the public io call. Recognized properties on
        the args object are:
      • canceller: (typeof Function)
        The canceller function used for the Deferred object. The function
        will receive one argument, the Deferred object that is related to the
        canceller.
      • okHandler: (typeof Function)
        The first OK callback to be registered with Deferred. It has the opportunity
        to transform the OK response. It will receive one argument -- the Deferred
        object returned from this function.
      • errHandler: (typeof Function)
        The first error callback to be registered with Deferred. It has the opportunity
        to do cleanup on an error. It will receive two arguments: error (the
        Error object) and dfd, the Deferred object returned from this function.
    • summary
      sets up the Deferred and ioArgs property on the Deferred so it
      can be used in an io call.
    • type
      Function
  • dojo._ioCancelAll

    • summary
      Cancels all pending IO requests, regardless of IO type
      (xhr, script, iframe).
    • type
      Function
  • dojo._ioNotifyStart

    • parameters:
      • dfd: (typeof Deferred)
    • summary
      If dojo.publish is available, publish topics
      about the start of a request queue and/or the
      the beginning of request.
    • description
      Used by IO transports. An IO transport should
      call this method before making the network connection.
    • type
      Function
  • dojo._ioWatch

    • parameters:
      • dfd: (typeof Deferred)
        The Deferred object to watch.
      • validCheck: (typeof Function)
        Function used to check if the IO request is still valid. Gets the dfd
        object as its only argument.
      • ioCheck: (typeof Function)
        Function used to check if basic IO call worked. Gets the dfd
        object as its only argument.
      • resHandle: (typeof Function)
        Function used to process response. Gets the dfd
        object as its only argument.
    • summary
      Watches the io request represented by dfd to see if it completes.
    • type
      Function
  • dojo._ioAddQueryToUrl

    • parameters:
      • ioArgs: (typeof dojo.__IoCallbackArgs)
    • summary
      Adds query params discovered by the io deferred construction to the URL.
      Only use this for operations which are fundamentally GET-type operations.
    • type
      Function
  • dojo.xhr

    • parameters:
      • method: (typeof String)
        HTTP method to be used, such as GET, POST, PUT, DELETE.  Should be uppercase.
      • args: (typeof dojo.__XhrArgs)
      • hasBody: (typeof Boolean)
        If the request has an HTTP body, then pass true for hasBody.
    • returns
      dojo.Deferred
    • summary
      Sends an HTTP request with the given method.
    • description
      Sends an HTTP request with the given method.
      See also dojo.xhrGet(), xhrPost(), xhrPut() and dojo.xhrDelete() for shortcuts
      for those HTTP methods. There are also methods for "raw" PUT and POST methods
      via dojo.rawXhrPut() and dojo.rawXhrPost() respectively.
    • type
      Function
  • dojo.xhrGet

    • parameters:
      • args: (typeof dojo.__XhrArgs)
    • returns
      dojo.Deferred
    • summary
      Sends an HTTP GET request to the server.
    • type
      Function
  • dojo.rawXhrPost

    • type
      Function
  • dojo.xhrPost

    • parameters:
      • args: (typeof dojo.__XhrArgs)
    • returns
      dojo.Deferred
    • summary
      Sends an HTTP POST request to the server. In addtion to the properties
      listed for the dojo.__XhrArgs type, the following property is allowed:
      postData:
      String. Send raw data in the body of the POST request.
    • type
      Function
  • dojo.rawXhrPut

    • type
      Function
  • dojo.xhrPut

    • parameters:
      • args: (typeof dojo.__XhrArgs)
    • returns
      dojo.Deferred
    • summary
      Sends an HTTP PUT request to the server. In addtion to the properties
      listed for the dojo.__XhrArgs type, the following property is allowed:
      putData:
      String. Send raw data in the body of the PUT request.
    • type
      Function
  • dojo.xhrDelete

    • parameters:
      • args: (typeof dojo.__XhrArgs)
    • returns
      dojo.Deferred
    • summary
      Sends an HTTP DELETE request to the server.
    • type
      Function
  • dojo._base.xhr

    • type
      Object
  • dojo._base

    • type
      Object