Ajax passes the value to controller,controller to extract the passed value?

problem description

I want to write AJAX, on the page and pass the value in an input to the action, in controller and take out the call. Please give me some advice

.

the environmental background of the problems and what methods you have tried

related codes

/ / Please paste the code text below (do not replace the code with pictures)
$(function () {

        $.ajax({
            type: "post",
            url: "/CustomsInspections/GetData",
            dataType: "json",
            //contentType: "application/json",
            data: {
                operation_id: $("-sharpOperation_ID").val(),
                fight_no: $("-sharpFlight_NO").val(),
                mbl: $("-sharpMBL").val(),
                consign_code_ck: $("-sharpConsign_Code_CK").val(),
            },
            success: function (data) {
                if (data == "success") {
                    console.log("");
                }
                else {
                    console.log("");
                }
            }
        });
    })

public ActionResult GetData (string operation_id,int page = 1, int rows = 10, string sort = "Id", string order = "asc", string filterRules = "")

    {
        var filters = JsonConvert.DeserializeObject<IEnumerable<filterRule>>(filterRules)??new List<filterRule>();
        var ArrFilter = new List<filterRule>();

        string  fight_no = Request["fight_no"].ToString();
        string  mbl = Request.Form["mbl"].ToString();
        string  consign_code_ck = Request.Params["consign_code_ck"].ToString();

what result do you expect? What is the error message actually seen?

I think it"s written on the Internet, but all the fight_no,mbl,consign_code_ck fetched are null

.
Mar.28,2021

Let go of the comment

< del >
/ / contentType: "application/json". DataType just indicates that the return type you expect is json has nothing to do with the request header you want to send
< / del >

just misread the back-end part. There is no problem with the value passed at the front end


is there something wrong with the writing I receive in the background?


what language is used in the backstage? javascript is toString (), not ToString ();

.
Menu