[Solved] jQuery Error: Unexpected end of input

slb2013
 
on Jul 27, 2022 11:33 PM
637 Views

Jquery button onclick function is not working

Uncaught Syntax error:  Unexpected end of input (at TestingSensorList:  line 16:161

Uncaught Syntax error:  Unexpected end of input (at TestingSensorList:  line 135:163

Uncaught Syntax error:  Unexpected end of input (at TestingSensorList:  line 249:161

<script type="text/javascript">
    function updateEventStatus(sensorID) {
        $("#btnUpd").click(function () {
            $.post("/Testing/SendDirtyFlags", { id: sensorID }, "active": false }, function (data) {
            if (data == "false") {
                if (dirty = "false")
                div.addClass("sensorStatusAlert");
                div.removeClass("sensorStatusOK");
                   else {
                    $.post("/Testing/SendDirtyFlags", { id: sensorID }, "active": true }, function (data) {
                        if (data == "true") {
                            if (dirty = "true")
                                div.addClass("sensorStatusOK");
                            div.removeClass("sensorStatusAlert");
                    alert("data");
                }
            });
        });
    }
</script>
Download FREE API for Word, Excel and PDF in ASP.Net: Download
dharmendr
 
on Jul 29, 2022 09:50 AM

Use below script.

<script type="text/javascript">
    function updateEventStatus(sensorID) {
        $("#btnUpd").click(function () {
            $.post("/Testing/SendDirtyFlags", { id: sensorID, "active": false }, function (data) {
                if (data == "false") {
                    if (dirty = "false") {
                        div.addClass("sensorStatusAlert");
                        div.removeClass("sensorStatusOK");
                    }
                }
                else {
                    $.post("/Testing/SendDirtyFlags", { id: sensorID, "active": true }, function (data) {
                        if (data == "true") {
                            if (dirty = "true") {
                                div.addClass("sensorStatusOK");
                                div.removeClass("sensorStatusAlert");
                                alert("data");
                            }
                        }
                    });
                }
            });
        });
    };
</script>