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

Curtis
  • 101,612
  • 66
  • 270
  • 352

1 Answers1

4

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
  • 17,978
  • 1
  • 29
  • 54
  • Thanks for your help, but its still not working. I've had a check on FireBug and the URL being posted is: GET http://domainname.com/AutoComplete/Model.ashx?q=p&limit=150&timestamp=1281974977218 Shouldnt this include "Make" as a query string? Cheers – Curtis Aug 16 '10 at 16:13
  • 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 Aug 16 '10 at 16:45
  • Looks like it was a cache issue, alls working fine! Cheers Bob! :D – Curtis Aug 17 '10 at 12:08
  • glad you figured it out @Curt – Bob Fincheimer Aug 17 '10 at 13:03