ASP.Net

jQuery Ajax Get calls fail in IE (Internet Explorer) but work in Firefox, Chome, Safari.. why?

You may have come across the situation where you are making a jQuery AJAX GET request to update part of your page with changing content, but it never updates or just returns blank content.

This issue has been around a long time, since first use of Ajax calls via XMLHTTP, but still causes headaches for people trying to debug the problem now.

What it actually comes down to is that the ‘Get’ call is working correctly, but Internet

Explorer (IE) caches the response, so you never get the updated results from the server.

What are the options:

  • 1) Use POST rather than GET – although this is not semantically correct, you should only POST when modifying contents on the server, technically there really is not much difference.
  • 2) (Preferred) You can disable caching globally using $.ajaxSetup(), for example:

    $.ajax
    Setup({ cache: false });
    This appends a timestamp to the querystring when making the request. To turn cache off for a particular $.ajax() call, set cache: false on it locally, like this: $.ajax({
    cache: false,
    //other options...
    });


Firefox 11 Memory Leak

I have always been a fan of Firefox and encouraged other developers to use it, addons such as Firebug and YSlow are simply essential tools for anything more than your most basic web page, and will even help with those. Neither the developer tools in Chrome, Safari or IE can really compete.

There certainly does seem to be an issue with the latest version of Firefox though regarding memory management, I am constantly seeing usage spiral up to around and over the 1GB value and become clunky and slow to respond. It looks like there is some effort going on at Mozilla to catch the culprits generally suspected to be certain addons, but personally I only used a few and still see the problem. I am looking at running some tests of my own to try and establish what is causing the issue. Firefox has been top of my toolbox for quite some time and it needs to stay that way.

Update:06-04-12 – Testing change to “Browser.sessionhistory.max”
Apparently Firefox defaults to storing 8 pages of history for each Tab that is open. This can be adjusted by setting “Browser.sessionhistory.max”
URL: about:config
Setting: Browser.sessionhistory.max
Default value is -1

Testing value set to 3.


MVC3 Razor - jQuery - Visual Studio != Intellisense

I wondered where my intellisense had gone for jQuery with MVC3 and Razor. Anyway there is a fix for it:

Add the following to your view (with the jQuery vsdoc version you have:

@if (false) { <script src="~/Scripts/jquery-1.5.0-vsdoc.js" type="text/javascript"></script> }

The if-statement prevents the script tag from being rendered into the html source code.

Grab jQuery 1.5.0 vsdoc from here -> http://damianedwards.com/files/jquery/jquery-1.5-vsdoc.js


A generic error occurred in GDI+” exception

I have bumped into this quite a few times. Every time I have it has turned out to be a path problem, always check this first.

If you can, stick a breakpoint on the save call and look at the path your are saving, follow the exact path and check it precisely using windows explorer.


Cannot have multiple items selected in a DropDownList (ASP.Net)

Nasty problem. Lesson learnt.

I could not figure out why I was seeing this error, clearselection, setting index -1 etc, nothing worked when trying to set a dropdownlist selected value from code behind.

Turns out it was because I was adding a ListItem to multiple dropdownlists without instantiating a new one for each dropdownlist. This caused all the problems I was seeing.

For every Dropdownlist, create a new instance of the ListItem object before adding it – do not share it accross controls.


Older Entries »