I use the PHP Codeigniter framework, which uses URLs such as http://www.mydomain.com/age/11/name/john/color/red, instead of regular lijke requests http://www.mydomain.com/index.php?age=11&name=john&color=red.
How to get key value agefrom url using javascript / jQuery?
After capturing the value, 11I will pass it to the jQuery object when the event fires.
$( "#searchdistance_slider" ).slider({
range: "min",
value: 5,
min: 0.5,
max: 10,
slide: function( event, ui ) {
$( "#search_distance" ).val(ui.value + " miles");
window.location.replace("http://www.domain.com/" + age);
}
});
UPDATE
- The key / value pair can change position , and the number of key / value pairs in the URL is not defined.
- Javascript, ,
age, 20 http://www.mydomain.com/age/20/name/john/color/red