I am using MVC and jquery to pull in a function from the server (as a partial view which I generate on the fly and append to the body of the html) and execute it. This works fine, I can view it in fiddler, but debugging is terrible. I pull in the method using something like:
$("#makeGrid").click(function (e) {
$.get('/gridder/basicgrid', callbackFn);
function callbackFn(data) {
//Append markup to dom
$('body').append(data);
// call the js function from the partialview here
generateGrid();
}
});
Whether this is best practice or not I'm not sure, but if I 'view source' after the ajax command, the code isn't visible, and using the debugger; command doesn't seem to work. Eg:
function generateGrid() {
alert("start");
debugger;
alert("end");
}
Creates the two alerts but doesn't bring up the debugger even though firebug is active. This discussion raises a similar issue. Some worked around it by using debugger twice (this bug meant to be gone now) or opening firebug in a new window (no luck). Even eval('debugger;'); was suggested by someone in another thread but no good!
Any suggestions? (including using a tool other than firebug if needed, but I want to debug, not view fiddler-style)