Ajax Utility functions
- Source:
Methods
(inner) fetchApi(httpMethod, url, payload, headers) → {object}
Make HTTP Fetch API call returning the JSON in the promise resolve
- Source:
Parameters:
Name | Type | Description |
---|---|---|
httpMethod |
string
|
GET, POST |
url |
string
|
URL |
payload |
object
|
body |
headers |
object
|
HTTP Headers |
Returns:
- Type:
-
object
promise
(inner) getUUID() → {string}
Generate UUID for creating AJAX requests
- Source:
Returns:
- Type:
-
string
returns random 16 char length string
(inner) interceptAjaxResponse(pageUrl, responseURL, pageURLsubstringMatch, responseURLsubstringMatch, cb)
Intercepts AJAX requests by overwriting the XMLHttpRequest prototype.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
pageUrl |
string
|
The page URL that this function is required on. This is important as the function should be restricted as much as possible |
responseURL |
string
|
The specific AJAX response URL the data is required from |
pageURLsubstringMatch |
boolean
|
If true - the pageURL can be matched as a substring. If false, the pageURL is matched as an absolute match |
responseURLsubstringMatch |
boolean
|
If true - the responseURL can be matched as a substring. If false, the responseURL is matched as an absolute match |
cb |
interceptAjaxResponseCallback
|
callback. returning the RepsonseURL and the RepsonseText |
Type Definitions
interceptAjaxResponseCallback(responseURL, responseText)
This callback is displayed as a global member.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
responseURL |
string
|
Ajax Response URL |
responseText |
string
|
Ajax response Text |