2
Hello! How can I get certain values in a link? I have a url like this: slide.html? title=Volume name=12 but I only want to display the volume value in an H2.
My Code:
$(document).ready(function(){
var html = '';
var query = location.search.slice(1);
var partesDaQuery = query.split("&");
var json = {};
partesDaQuery.forEach(function(partes){
var chaveValor = partes.split('=');
var paramsKey = chaveValor[0];
var paramsValue = chaveValor[1];
json[paramsKey] = paramsValue;
html += '<h2></h2>';
console.log(paramsValue);
});
$("#lista").html(html);
});
The link is always in this pattern?
– Sam
It is. It will keep that way.
– OliverDamon