Click here to Skip to main content
15,890,947 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Ive got a javascript function that gives me the error
in the title of the question.

Below is my code:

C#
function ToggleVProcure(chkValidProc) {
    $.ajax({ type: "POST", url: "DocumentManager.aspx", data: { Action: "ValidateProcure", Id: chkValidProc.attributes["DId"].value }, dataType: "json",
        success: function (data, textStatus) {
            if (textStatus == "success") {

                var chkProc = $('[did="' + chkValidProc.attributes["Did"].value + '"]');
                var checkCPD = $('[docid="' + chkValidProc.attributes["Did"].value + '"]');
                var span = $('#span' + chkValidProc.attributes["Did"].value);
                var supplierId = $("#chkValidProc").attr("SId");

                if (checkCPD.attr('checked') && chkProc.attr('checked')) {

                    span.attr("style", "color: Green;");

                    var s = $('input[SId="' + supplierId + '"]:checked').length;

                    var totalperc = (s / 13 * 100).toFixed(1);
                    $(chkValidProc.parentNode.parentNode.parentNode.parentNode).find('#lblTotalScore').text(Math.floor(totalperc.toString()));

                }
                else {

                    span.attr("style", "color: Red;");
                    var s = $('input[SId="' + supplierId + '"]:checked').length;

                    var totalperc = (s / 13 * 100).toFixed(1);
                    $(chkValidProc.parentNode.parentNode.parentNode.parentNode).find('#lblTotalScore').text(Math.floor(totalperc.toString()));

                }

                MyAlert("Success", "This Document's Procurement Validation Status Has been Updated.", "NOTE");
            }
        },
        error: function (data, textStatus, errorThrown) {
            alert("An unexpected error occurred: " + errorThrown);
        }
    });
}



Please help.
Posted
Comments
Sergey Alexandrovich Kryukov 10-Sep-12 16:25pm    
Can you use a JavaScript debugger? If you can enable and use it, this problem can be easily detected and fixed...
--SA
Ankur\m/ 11-Sep-12 4:23am    
Exactly! Use something like Firebug script debugger to find the root cause.
Sergey Alexandrovich Kryukov 11-Sep-12 13:27pm    
Also possible to do with Visual Studio.
--SA
Ankur\m/ 14-Sep-12 7:42am    
Of course. Just add debugger before the line of code you want to debug and use IE to browse the site (this info is for Question poster).

I used that feature a few months back and it help me solve an issue which Firebug failed to find.
Sergey Alexandrovich Kryukov 14-Sep-12 13:21pm    
Good idea to share.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900