It looks like you've got the function keyword inside the slide callback which is where you want to call the myAjax function, not declare it. I think you want something like this
function myAjax(val1, val2) { // do something with ajax and the two values passed in, val1 and val2 } $(function() { $("#slider-range").slider({ slide: function(event, ui) { myAjax(ui.values[0], ui.values[1]); } }); }); - Richard On Mon, Mar 16, 2009 at 1:33 PM, borg <markk1...@gmail.com> wrote: > > Hi I am a novice to javascript and jquery developer trying to pass > slider values to an AJAX script. My slieder looks like this: > > $(function() { > $("#slider-range").slider({ > range: true, > min: -10, > max: 66, > //values: [Math.pow(10,2), Math.pow(10,5)], > values: [20, 30], > slide: function(event, ui) { > $("#amount").val('' + > (Math.round(Math.pow(10,(ui.values[0] / > 10))) ) + ' - ' + (Math.round(Math.pow(10,(ui.values[1] / 10))) )); > } > }); > //$("#amount").val('' + $("#slider-range").slider("values", > 0) + ' - > ' + $("#slider-range").slider("values", 1)); > > }); > > How can I pass slider values ui.values[0] and ui.values[1] to a > different javascript function which then via AJAX passes the is to the > ASP script. I tried calling the function like this but it does not > work: > > slide: function(event, ui) { > $("#amount").val('' + > (Math.round(Math.pow(10,(ui.values[0] / > 10))) ) + ' - ' + (Math.round(Math.pow(10,(ui.values[1] / 10))) )); > > function myAjax(ui.values[0], ui.values[0]); > } > }); > The slieder stops working when I include the function call. What am I > doing wrong? Please help. > >