Referencia httpDo()

httpDo()

Method for executing an HTTP request. If data type is not specified, p5 will try to guess based on the URL, defaulting to text.

For more advanced use, you may also pass in the path as the first argument and a object as the second argument, the signature follows the one specified in the Fetch API specification. This method is suitable for fetching files up to size of 64MB when "GET" is used.

Ejemplos

Sintaxis

httpDo(path, [method], [datatype], [data], [callback], [errorCallback])
httpDo(path, options, [callback], [errorCallback])

Parámetros

path
String:

name of the file or url to load

method
String:

either "GET", "POST", or "PUT", defaults to "GET"

datatype
String:

"json", "jsonp", "xml", or "text"

data
Object:

param data passed sent with request

callback
Function:

function to be executed after httpGet() completes, data is passed in as first argument

errorCallback
Function:

function to be executed if there is an error, response is passed in as first argument

options
Object:

Request object options as documented in the "fetch" API reference

Notice any errors or typos? Please let us know. Please feel free to edit src/io/files.js and open a pull request!

Referencias Relacionadas