This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| programmieren:javascript:alpinejs_ajax_beispiel [2022/09/14 08:07] – jgehrke | programmieren:javascript:alpinejs_ajax_beispiel [2022/12/17 12:28] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 48: | Line 48: | ||
| xhttp.setRequestHeader(" | xhttp.setRequestHeader(" | ||
| xhttp.onreadystatechange = function() { | xhttp.onreadystatechange = function() { | ||
| - | if(this.readyState == 4 && this.status == 200) { | + | const is_call_success = (this.readyState == 4 && this.status == 200) ? true : false; |
| + | |||
| + | if( is_call_success | ||
| const response_json = JSON.parse( this.response ); | const response_json = JSON.parse( this.response ); | ||
| - | console.log( " | ||
| - | console.log( response_json ); | ||
| - | |||
| /* | /* | ||
| | | ||