how to pass the model variable as an argument

how to pass the model variable as an argument

polachanpolachan Posts: 101Questions: 50Answers: 0
edited May 2019 in Free community support

Hi
I am using the following model in an html and the value is passing to the html using the model. The model contain a variable Employees. I want to pass the value in the Employee as an argument to the ajax function., How can I pass the model as an argument under data : Please can you help

@model ReportViewModel
<table id="tblClockVariance" class="table table-bordered table-striped" style="width:100%;font-size:90%">

$('#tblClockVariance').DataTable({
            "processing": true,
            //"serverSide": true,

            "ajax": {
                "url": "/Report/ClockingVarianceData", 
                "data": {
                    "user_id": 451
                  
                },
                 "dataSrc": function (json) {
                    return JSON.parse(json);
                }
            },

Answers

  • sandysandy Posts: 913Questions: 0Answers: 236

    Hi polachan,

    Do you have the Employees variable available in javascript? And I assume it is a constant value for the whole table rather than changing per row?

    Cheers,
    Sandy

This discussion has been closed.