Click here to Skip to main content
14,640,723 members
Rate this:
Please Sign up or sign in to vote.
See more:
Ive got a javascript function that gives me the error
in the title of the question.

Below is my code:

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);

                else {

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

                    var totalperc = (s / 13 * 100).toFixed(1);


                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.
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...
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.
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.

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

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100