JavaScript: Unterschied zwischen den Versionen
Aus wiki
(Die Seite wurde neu angelegt: «=== check if array contain === if (data.roles.indexOf('Tenant') !== -1) { $scope.tenantRole = true; console.log('Tenant gefunden'…») |
|||
| Zeile 1: | Zeile 1: | ||
=== check if array contain === | === check if array contain === | ||
| + | |||
if (data.roles.indexOf('Tenant') !== -1) { | if (data.roles.indexOf('Tenant') !== -1) { | ||
$scope.tenantRole = true; | $scope.tenantRole = true; | ||
| Zeile 6: | Zeile 7: | ||
console.log('Tenant nicht gefunden'); | console.log('Tenant nicht gefunden'); | ||
} | } | ||
| + | |||
| + | |||
| + | === CORS === | ||
| + | == Options Request == | ||
| + | Types of CORS requests | ||
| + | |||
| + | Cross-origin requests come in two flavors: | ||
| + | |||
| + | simple requests | ||
| + | "not-so-simple requests" (a term I just made up) | ||
| + | Simple requests are requests that meet the following criteria: | ||
| + | HTTP Method matches (case-sensitive) one of: | ||
| + | HEAD | ||
| + | GET | ||
| + | POST | ||
| + | HTTP Headers matches (case-insensitive): | ||
| + | Accept | ||
| + | Accept-Language | ||
| + | Content-Language | ||
| + | Last-Event-ID | ||
| + | Content-Type, but only if the value is one of: | ||
| + | application/x-www-form-urlencoded | ||
| + | multipart/form-data | ||
| + | text/plain | ||
Aktuelle Version vom 17. Februar 2015, 14:57 Uhr
check if array contain
if (data.roles.indexOf('Tenant') !== -1) {
$scope.tenantRole = true;
console.log('Tenant gefunden');
} else {
console.log('Tenant nicht gefunden');
}
CORS
Options Request
Types of CORS requests Cross-origin requests come in two flavors: simple requests "not-so-simple requests" (a term I just made up) Simple requests are requests that meet the following criteria: HTTP Method matches (case-sensitive) one of: HEAD GET POST HTTP Headers matches (case-insensitive): Accept Accept-Language Content-Language Last-Event-ID Content-Type, but only if the value is one of: application/x-www-form-urlencoded multipart/form-data text/plain