Marius Vasile

Marius Vasile

  • 1.1k
  • 1.1k
  • 34.9k

how do I pass a Model value to jquery?

Aug 11 2021 4:14 PM

I want to use a Model value as jquery variable. In my case idinv and app. How do I pass it?

 

$(function () {
            $("#Member").on("change", function () {
                var categoryId = $(this).val();
                var idinv =@Model.IdINV;
                var app = @Model.APP;
                var msg = "";
                $.getJSON(`?handler=CheckUserName&id=${categoryId}&idinv=${idinv}&app=${app}`, (data) => {
                    if (data == true) {
                        $("#btnSubmit").attr("disabled", true);
                        msg = msg + categoryId + " " + "is already member of Investigation Team";
                    }
                    else {
                        $("#btnSubmit").attr("disabled", false);
                    }
                    $("#msgUN").text(msg);
                });
            });
        });

 


Answers (1)