Saturday, April 28, 2012

Aaargh Ajax!!

First of all, I've got to say in my defence that I've mainly worked as a server-side programmer for the last twenty odd years, so JavaScript has never been my strong suit. Having said that I should have had enough knowledge by now to construct a simple Ajax cascading drop down on an ASP.NET application.

I won't share with you how much time I wasted debugging this thing in Visual Studio, rummaging through Firebug and inspecting requests in Fiddler.

Anyway the penny just dropped and I feel so SO dumb for not realising it sooner. Basically I had a sub on the server and a sub on the client in JavaScript that basically did the same thing so I had given them the same name. So while debugging I'd brainwashed myself into thinking the server script was firing when in fact it was the one on the client.

NOTE TO SELF. FROM NOW ON, BE SMART. USE A NAMING STRATEGY THAT CLEARLY SHOWS WHETHER A ROUTINE IS ON THE CLIENT OR THE SERVER.

No comments: