Question

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

Was it helpful?

Solution

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(); 
      }
    } 
  });
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top