This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
programmieren:javascript:get_parameter_aus_der_url_auslesen [2024/10/03 10:19] – jgehrke | programmieren:javascript:get_parameter_aus_der_url_auslesen [2024/10/03 10:20] (current) – jgehrke | ||
---|---|---|---|
Line 4: | Line 4: | ||
<code javascript> | <code javascript> | ||
- | const get_url_parameters = function() { | + | const get_url_parameters = function() { |
- | const URL = window.location.href; | + | const URL = window.location.href; |
- | const has_params = ( URL.split("?" | + | const has_params = ( URL.split("?" |
- | if( !has_params ) return {} // -- exit, wenn es keine Parameter gibt | + | if( !has_params ) return {} // -- exit, wenn es keine Parameter gibt |
- | const URL_params = JSON.parse(' | + | const URL_params = JSON.parse(' |
- | return URL_params; | + | return URL_params; |
- | }; | + | }; |
- | getParameters() | + | getParameters(); // Result: { search : " |
- | // Result: { search : " | + | |
</ | </ | ||
Code quelle von einem dev.to Beitrag: [[https:// | Code quelle von einem dev.to Beitrag: [[https:// |