0

I am using a common ajax function to handle my HttpPost,HttpGet request. But I am unable to pass parameter to the server through the ajax request.

Any help will be highly appreciated

$(document).on("click", ".btnEdit", function () {
    var id = $(this).data('id');
    var url = $("#btnShowModal").data('url');

    ajaxOperation(url, 'GET', null, id, showModal);                
});

function ajaxOperation(url, httpVerb, dataType, dataToSend,  callback) {
$.ajax({
    url: url,
    type: httpVerb,
    datatype: dataType,
    data: dataToSend,
    success: function (data) {

        if (callback != undefined) {
            callback(data)
        }
    },
    error: function (e) {
        toastr.error("Unexpected error");
    }
});
}

On the server I am getting id as null

ksg
  • 3,927
  • 7
  • 51
  • 97

0 Answers0