I have this url:
http://localhost/pagina.php?grado=2&escuela=urbano
I want to be able to take the degree and school fields with their values and place them in a variable called data, how can I do that, and try several ways but it marks me error
I have this url:
http://localhost/pagina.php?grado=2&escuela=urbano
I want to be able to take the degree and school fields with their values and place them in a variable called data, how can I do that, and try several ways but it marks me error
You can get the current url with window.location.href
, then support yourself in the URL class to extract the parameters:
var url = new URL('http://localhost/pagina.php?grado=2&escuela=urbano');
var grado = url.searchParams.get('grado');
console.log(grado);