Skip to content

Instantly share code, notes, and snippets.

@jpalala
Created May 5, 2020 15:46
Show Gist options
  • Save jpalala/7c8866851c8c4bac6049fb6ddbe819ee to your computer and use it in GitHub Desktop.
Save jpalala/7c8866851c8c4bac6049fb6ddbe819ee to your computer and use it in GitHub Desktop.
searchparams using location.search
<!doctype html>
<html>
<script>
var search = location.search;
var paramsString = "?p=2&topic=api";
//var searchParams = new URLSearchParams(paramsString);
var searchParams = new URLSearchParams(search);
console.log('s: ', search);
console.log(searchParams.get("p"));
</script>
</html>
python -m SimpleHTTPServer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment