Get and print current but separate values from Egor Khmelev's slider plugin
Using the Slider Jquery plugin from Egor Khmelev, I've managed to set the slider the way I want it (to set a range of years), and want to use the pair of values set by it to build a search query. So following the author's example, I have the following slider code:
jQuery("#Slider1").slider({ from: 1000, to: 100000, step: 500, smooth: true, round: 0, dimension: " $", skin: "plastic" });
There is a function to show the value, but as I'm using a double slider, I'd need to separate those.
$(document).ready(function(){
$("#searchButton").click(function(event){
var myPair = null;
myPair = $("#Slider1").slider("value");
alert(myPair); // using alert just to see the result
});
});
That code outputs the pair indeed ("value1;value2"). What I'm after (and I'm a comple开发者_开发知识库te newbe on this) is to have each value on a separate variable, and then be able to pass that variable in a "parameter style" search query for a standard php/html form, like
search.php?term=myTerm&yearFrom=1990&yearTo=2010
Any and all ideas are welcome!
How about:
var myPair = null;
myPair = $("#Slider1").slider("value");
var split = myPair.split(';');
var query = 'search.php?term=myTerm&yearFrom=' + split[0] + '&yearTo=' + split[1];
精彩评论