Configuration of the AJAX requests used by Crud Manager to communicate with a server-side.
transport : {
load : {
url : 'http://mycool-server.com/load.php',
// HTTP request parameter used to pass serialized "load"-requests
paramName : 'data',
// pass extra HTTP request parameter
params : {
foo : 'bar'
}
},
sync : {
url : 'http://mycool-server.com/sync.php',
// specify Content-Type for requests
headers : {
'Content-Type' : 'application/json'
}
}
}
Since the class uses Fetch API you can use any of the Request interface options:
transport : {
load : {
url : 'http://mycool-server.com/load.php',
// HTTP request parameter used to pass serialized "load"-requests
paramName : 'data',
// pass few Fetch API options
method : 'GET',
credentials : 'include',
cache : 'no-cache'
},
sync : {
url : 'http://mycool-server.com/sync.php',
// specify Content-Type for requests
headers : {
'Content-Type' : 'application/json'
},
credentials : 'include'
}
}
An object where you can set the following possible properties:
- load : Object
Load requests configuration:
- url : String
URL to request for data loading.
- method : String'GET'
HTTP method to be used for load requests.
- paramName : String'data'
Name of the parameter that will contain a serialized load request. The value is mandatory for requests using GET method (default for load) so if the value is not provided data string is used as default. This value is optional for HTTP methods like POST and PUT, the request body will be used for data transferring in these cases.
- params : Object
An object containing extra HTTP parameters to pass to the server when sending a load request.
transport : {
load : {
url : 'http://mycool-server.com/load.php',
// HTTP request parameter used to pass serialized "load"-requests
paramName : 'data',
// pass extra HTTP request parameter
// so resulting URL will look like: http://mycool-server.com/load.php?userId=123456&data=...
params : {
userId : '123456'
}
},
...
}
- headers : Object<String, String>
An object containing headers to pass to each server request.
transport : {
load : {
url : 'http://mycool-server.com/load.php',
// HTTP request parameter used to pass serialized "load"-requests
paramName : 'data',
// specify Content-Type for "load" requests
headers : {
'Content-Type' : 'application/json'
}
},
...
}
- sync : Object
Sync requests (sync in further text) configuration:
- url : String
- method : String'POST'
HTTP request method to be used for sync.
- paramName : String
Name of the parameter in which sync data will be transferred. This value is optional for requests using methods like POST and PUT, the request body will be used for data transferring in this case (default for sync). And the value is mandatory for requests using GET method (if the value is not provided data string will be used as fallback).
- params : Object
HTTP parameters to pass with an HTTP request handling sync.
transport : {
sync : {
url : 'http://mycool-server.com/sync.php',
// extra HTTP request parameter
params : {
userId : '123456'
}
},
...
}
- headers : Object<String, String>
HTTP headers to pass with an HTTP request handling sync.
transport : {
sync : {
url : 'http://mycool-server.com/sync.php',
// specify Content-Type for "sync" requests
headers : {
'Content-Type' : 'application/json'
}
},
...
}