At the moment I have an action link which submits data to an action. It also calls a function which populated some JQuery parameters based on data on the view. I would like to append these JQuery values to the action link so they can get submitted at the same time.

View:

 <div class="AltFunctions">
                    <ul>
                        <li>
                            @Html.ActionLink("fd", "ExportClaimBySupplier", "Search", new {ClientID = Model.inputParameters[0], SupplierID = Model.inputParameters[1], JsonReviewPeriod = Json.Encode(Model.inputReviewPeriodIDs), GroupID = Model.inputParameters[2], AmountFrom = JQueryValue, AmountTo = JQueryValue, AllDDValues = JQueryValue}, new { @id = "altExportButton", @class = "AltButton", Title = " Export data to excel" })
                        </li>
                        <li>
                            <a href="#ClaimsBySupplierModal" data-target="#ClaimsBySupplierModal" data-toggle="modal" class="AltButton" id="altInfoButton" title="Information on the Supplier report">Info</a>
                        </li>
                    </ul>
                </div>

JQuery:

<script>
  $('#altExportButton').on('click', function () {
            var AmountFrom = $('#txtAmountFrom').val();
            var AmountTo = $('#txtAmountTo').val();
            var AllDDValues;
            var count = 1;
            $('.ExportValues').each(function () {

                if (count == 1) {
                    AllDDValues = this.value;
                    count = 2;
                }
                else if(count == 2 && AllDDValues != "") {
                    AllDDValues = AllDDValues + ", " + this.value;
                }
            });            
        });

    </script>

I would need to append AmountFrom, AmountTo and AllDDValues to the action link.

Related posts

Recent Viewed