Thanks for the response. I may have jumped to the incorrect conclusion - the article was about web services: http://encosia.com/2008/03/27/using-jquery-to-consume-aspnet-json-web-services/
I do use the json helper you mentioned, thanks. Never used .ashx. I'll try that. On Jun 2, 3:17 pm, MorningZ <morni...@gmail.com> wrote: > "What I've learned is that the $.getJason > will not work on .Net because of the handler" > > I have no idea how such a conclusion came about, but rest assured that > the $.getJSON method most definitely works with .NET > > I don't have time to really go through all that code, but i will > provide some advice: > > 1) Use a Generic Handler (.ashx) instead of a web form page (.aspx), > that way you avoid all the totally unnecessary overhead of going > through the page life cycle > 2) Check out NewtonSoft's Json.NET object, it really makes life easy > as it will convert objects, collections, arrays, just about anything > in the .NET world to JSON > > On Jun 2, 4:07 pm, will <wml...@gmail.com> wrote: > > > I can not get this combo to work with an example from jQuery in > > action. I'm trying to port the examples from jsp to .net. I'll post > > the least amount of code. What I've learned is that the $.getJason > > will not work on .Net because of the handler (not sure if this is true > > but either method does not work), .Net will only process post request > > for json. > > > <script type="text/javascript"> > > $(function(){ > > $('#styleDropdown') > > .change(function(){ > > var styleValue = $(this).val(); > > $('#detailsDisplay').load( > > 'getDetails.aspx', > > { style: styleValue } > > ); > > adjustColorDropdown(); > > }) > > .change(); > > $('#colorDropdown') > > .change(adjustSizeDropdown); > > }); > > > function adjustColorDropdown() { > > var styleValue = $('#styleDropdown').val(); > > var dropdownSet = $('#colorDropdown'); > > if (styleValue.length == 0) { > > dropdownSet.attr("disabled", true); > > $(dropdownSet).emptySelect(); > > } > > else { > > dropdownSet.attr("disabled", false); > > // > > $.ajax({ type: "POST", contentType: "application/json; > > charset=utf-8", > > url: "getColors.aspx", > > data: "{}", > > dataType: "json", > > success: function(data) { > > $('#errorDisplay').css('display', 'none'); > > $(dropdownSet).loadSelect(data); > > adjustSizeDropdown(); > > }, > > error: function(xhr) { > > $('#errorDisplay').html('Error getting colors: ' > > + xhr.status + ' ' + xhr.statusText); > > $('#errorDisplay').css('display', 'block'); > > } > > }); > > } > > } > > > function adjustSizeDropdown() { > > var styleValue = $('#styleDropdown').val(); > > var colorValue = $('#colorDropdown').val(); > > var dropdownSet = $('#sizeDropdown'); > > if ((styleValue.length == 0) || (colorValue.length == 0)) { > > dropdownSet.attr("disabled", true); > > $(dropdownSet).emptySelect(); > > adjustSizeDropdown(); > > } > > else { > > dropdownSet.attr("disabled", false); > > $.ajax({ type: "POST", contentType: "application/json; > > charset=utf-8", > > url: "getSizes.aspx", > > data: "{}", > > dataType: "json", > > success: function(data) { > > $('#errorDisplay').css('display', 'none'); > > $(dropdownSet).loadSelect(data); > > adjustSizeDropdown(); > > }, > > error: function(xhr) { > > $('#errorDisplay').html('Error getting colors: ' > > + xhr.status + ' ' + xhr.statusText); > > $('#errorDisplay').css('display', 'block'); > > } > > }); > > } > > } > > </script>