views:

155

answers:

1

I'm using the following jQuery script to send a 'Make' parameter to filter my 'Models':

$(document).ready(function () { $(".autocomplete_make").autocomplete("/AutoComplete/Make.ashx"); });
$(document).ready
    (function () {
        $(".autocomplete_model").autocomplete("/AutoComplete/Model.ashx"
                                                    , extraParams: {
                                                        make: function() {return $(".autocomplete_make").val(); }
                                                    }
                                                   );
    });

The text entered is passed to the .ashx file as a 'q' querystring, however, I'm not sure how I access my extraParam 'Make' so I can pass this to my stored procedure in the Generic Handler file. How do I do this?

Thanks, Curt

+3  A: 

It should be as simple as:

context.Request("make")

Which I believe you know already.

The only other problem I see is that your javascript looks a little flawed because you are not passing in an object as the second parameter (the options).

Here is the corrected code (I hope):

$(document).ready(function () {
  $(".autocomplete_model").autocomplete("/AutoComplete/Model.ashx", {
    extraParams: {
      make: function() {
        return $(".autocomplete_make").val(); 
      }
    } 
  });
});
Bob Fincheimer
Curt
it should include make, that is weird that it isn't... Are you sure the you updated the code to exactly what is above? also,is there any other related code?
Bob Fincheimer
Looks like it was a cache issue, alls working fine! Cheers Bob! :D
Curt
glad you figured it out @Curt
Bob Fincheimer