Fetch
Fetch Javascript
Example
let responseJSON;
try{
const response = await fetch('/Something/YourURL', {
method: 'POST',
body: JSON.stringify({}),
headers: { 'Content-Type': 'application/json', 'X-Requested-With': 'fetch' }
});
//if(!response.ok) throw new Error(`Error processing request: ${response.statusText}`);
responseJSON = await response.json();
}catch(error){
console.error(error);
// error function here
}
if(responseJSON){
if(responseJSON.Success) // successful function here
else //error function here
}
Resources
Sass File(s) | None |
---|---|
JS File(s) | None Required |
JS Functions | See Above |
Locale Keys | None |
Accessibility
None at this time.