1

How to change this in ajax call. This is the jquery code which is calling the controller and getting the data from the database and onclick of checkbox filtering of data is happening and displaying the resulted data. Now my my requirement is do this thing with ajax call. How should I do.

$('input[name^="checkbox_"]').click(function () {
    $('#checkbox_all').prop('checked', false);
    var Status = $(this).val();
    if (Status == 'allocated') {
        var url = "statusAdmin.html?Status=" + Status;
        $(location).attr('href', url);
    }
});
1

1 Answer 1

1

To make the same with Ajax you need to change the logic like this:

$('input[name^="checkbox_"]').click(function () {
    $('#checkbox_all').prop('checked', false);
    var status = this.value;
    $.ajax({
        url: "statusAdmin.html?Status=" + status,
        success: function (res) {
            //do something with the response
        }
    });
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.