How to trigger a change on button click
I want to update a dropdownlist when another button is click by calling trigger but getting an error. Below is my code any help will be appreciated
- $("#btnReplace").click(function () {
-
- const oldPersonId = $('#OldbuttonId').val();
- const newPersonId = $('#newPersonID').val();
- var button = this;
- $.ajax({
- method: "POST",
- url: "@Url.Action("Replaced", "NewReplacement")",
- data: { OldId: oldPersonId, NewId: newPersonId},
- success: function (response) {
-
- $('#cdrl-load-text', button).html('Saved!');
- if (response != null && response.success) {
- alert(response.message);
- } else
- {
- alert(message);
- }
- debugger;
- $("#OldbuttonId").val().trigger('change');
-
- },
- error: function (xhr) {
- alert('Error: No Replaced happened.');
- }
- });
- });