hx.request("/file.txt", "text/plain", function(error, data){
// do something
})
hx.request("/file.txt",{data:11010000}, function(error, data){
// do something
})
// Load multiple urls with one call to hx.request and one callback
urls = [
'/file1.txt',
'/file2.txt'
]
hx.request(urls, function(error, data, source, index){
if index is -1
// data is all response data, source is all sources
else
// data is single response, index indicates which request
})
fetch
. You should transition to using fetch
alongside a suitable polyfill 'http://your-server/'
// Object with url
{
url: 'http://your-server/'
}
// Object with url and data
{
url: 'http://your-server/',
data: {
your: 'data'
}
}
// Array of strings
[
'http://your-server-1/',
'http://your-server-1/'
]
// Array of objects
[
{
url: 'http://your-server-1/'
},
{
url: 'http://your-server-2/'
}
]
// Mixed Array
[
'http://your-server/',
{
url: 'http://your-server/'
},
{
url: 'http://your-server/'
data: {
a: 1
}
}
]
// No data provided
'http://your-server/'
// Data provided
{
url: 'http://your-server/'
data: {
your: 'data'
}
}
headers = {
'Content-Type': 'text/plain', // explicitly set the content type ot text/plain, can also be set with the 'contentType' option
'accepts': 'text/plain,*/*', // explicitly set the accepts header.
'custom': 'dave' // set a custom header
}
fetch
. You should transition to using fetch
alongside a suitable polyfill 'http://your-server/'
// Object with url
{
url: 'http://your-server/'
}
// Object with url and data
{
url: 'http://your-server/',
data: {
your: 'data'
}
}
// Array of strings
[
'http://your-server-1/',
'http://your-server-1/'
]
// Array of objects
[
{
url: 'http://your-server-1/'
},
{
url: 'http://your-server-2/'
}
]
// Mixed Array
[
'http://your-server/',
{
url: 'http://your-server/'
},
{
url: 'http://your-server/'
data: {
a: 1
}
}
]
// No data provided
'http://your-server/'
// Data provided
{
url: 'http://your-server/'
data: {
your: 'data'
}
}
headers = {
'Content-Type': 'text/plain', // explicitly set the content type ot text/plain, can also be set with the 'contentType' option
'accepts': 'text/plain,*/*', // explicitly set the accepts header.
'custom': 'dave' // set a custom header
}
fetch
. You should transition to using fetch
alongside a suitable polyfill 'http://your-server/'
// Object with url
{
url: 'http://your-server/'
}
// Object with url and data
{
url: 'http://your-server/',
data: {
your: 'data'
}
}
// Array of strings
[
'http://your-server-1/',
'http://your-server-1/'
]
// Array of objects
[
{
url: 'http://your-server-1/'
},
{
url: 'http://your-server-2/'
}
]
// Mixed Array
[
'http://your-server/',
{
url: 'http://your-server/'
},
{
url: 'http://your-server/'
data: {
a: 1
}
}
]
// No data provided
'http://your-server/'
// Data provided
{
url: 'http://your-server/'
data: {
your: 'data'
}
}
headers = {
'Content-Type': 'text/plain', // explicitly set the content type ot text/plain, can also be set with the 'contentType' option
'accepts': 'text/plain,*/*', // explicitly set the accepts header.
'custom': 'dave' // set a custom header
}
fetch
. You should transition to using fetch
alongside a suitable polyfill 'http://your-server/'
// Object with url
{
url: 'http://your-server/'
}
// Object with url and data
{
url: 'http://your-server/',
data: {
your: 'data'
}
}
// Array of strings
[
'http://your-server-1/',
'http://your-server-1/'
]
// Array of objects
[
{
url: 'http://your-server-1/'
},
{
url: 'http://your-server-2/'
}
]
// Mixed Array
[
'http://your-server/',
{
url: 'http://your-server/'
},
{
url: 'http://your-server/'
data: {
a: 1
}
}
]
// No data provided
'http://your-server/'
// Data provided
{
url: 'http://your-server/'
data: {
your: 'data'
}
}
headers = {
'Content-Type': 'text/plain', // explicitly set the content type ot text/plain, can also be set with the 'contentType' option
'accepts': 'text/plain,*/*', // explicitly set the accepts header.
'custom': 'dave' // set a custom header
}
fetch
. You should transition to using fetch
alongside a suitable polyfill 'http://your-server/'
// Object with url
{
url: 'http://your-server/'
}
// Object with url and data
{
url: 'http://your-server/',
data: {
your: 'data'
}
}
// Array of strings
[
'http://your-server-1/',
'http://your-server-1/'
]
// Array of objects
[
{
url: 'http://your-server-1/'
},
{
url: 'http://your-server-2/'
}
]
// Mixed Array
[
'http://your-server/',
{
url: 'http://your-server/'
},
{
url: 'http://your-server/'
data: {
a: 1
}
}
]
// No data provided
'http://your-server/'
// Data provided
{
url: 'http://your-server/'
data: {
your: 'data'
}
}
headers = {
'Content-Type': 'text/plain', // explicitly set the content type ot text/plain, can also be set with the 'contentType' option
'accepts': 'text/plain,*/*', // explicitly set the accepts header.
'custom': 'dave' // set a custom header
}
fetch
. You should transition to using fetch
alongside a suitable polyfill 'http://your-server/'
// Object with url
{
url: 'http://your-server/'
}
// Object with url and data
{
url: 'http://your-server/',
data: {
your: 'data'
}
}
// Array of strings
[
'http://your-server-1/',
'http://your-server-1/'
]
// Array of objects
[
{
url: 'http://your-server-1/'
},
{
url: 'http://your-server-2/'
}
]
// Mixed Array
[
'http://your-server/',
{
url: 'http://your-server/'
},
{
url: 'http://your-server/'
data: {
a: 1
}
}
]
// No data provided
'http://your-server/'
// Data provided
{
url: 'http://your-server/'
data: {
your: 'data'
}
}
headers = {
'Content-Type': 'text/plain', // explicitly set the content type ot text/plain, can also be set with the 'contentType' option
'accepts': 'text/plain,*/*', // explicitly set the accepts header.
'custom': 'dave' // set a custom header
}
fetch
. You should transition to using fetch
alongside a suitable polyfill 'http://your-server/'
// Object with url
{
url: 'http://your-server/'
}
// Object with url and data
{
url: 'http://your-server/',
data: {
your: 'data'
}
}
// Array of strings
[
'http://your-server-1/',
'http://your-server-1/'
]
// Array of objects
[
{
url: 'http://your-server-1/'
},
{
url: 'http://your-server-2/'
}
]
// Mixed Array
[
'http://your-server/',
{
url: 'http://your-server/'
},
{
url: 'http://your-server/'
data: {
a: 1
}
}
]
// No data provided
'http://your-server/'
// Data provided
{
url: 'http://your-server/'
data: {
your: 'data'
}
}
headers = {
'Content-Type': 'text/plain', // explicitly set the content type ot text/plain, can also be set with the 'contentType' option
'accepts': 'text/plain,*/*', // explicitly set the accepts header.
'custom': 'dave' // set a custom header
}
fetch
. You should transition to using fetch
alongside a suitable polyfill 'http://your-server/'
// Object with url
{
url: 'http://your-server/'
}
// Object with url and data
{
url: 'http://your-server/',
data: {
your: 'data'
}
}
// Array of strings
[
'http://your-server-1/',
'http://your-server-1/'
]
// Array of objects
[
{
url: 'http://your-server-1/'
},
{
url: 'http://your-server-2/'
}
]
// Mixed Array
[
'http://your-server/',
{
url: 'http://your-server/'
},
{
url: 'http://your-server/'
data: {
a: 1
}
}
]
// No data provided
'http://your-server/'
// Data provided
{
url: 'http://your-server/'
data: {
your: 'data'
}
}
headers = {
'Content-Type': 'text/plain', // explicitly set the content type ot text/plain, can also be set with the 'contentType' option
'accepts': 'text/plain,*/*', // explicitly set the accepts header.
'custom': 'dave' // set a custom header
}