Id in the controller is wrong value after ajax post.

I have the following COntroller Action.

[HttpPost]
        public ActionResult GetThreatActor(int id)
        {
           
        }

and i do a ajax call..

        var $id = $(this).val();
       
        $.ajax({
            url: "/ThreatActor/GetThreatActor/",
            type: "POST",
            data: $id,
            success: function (threatActor) {
               
            }
        });
       

the id is equal to 9469952 however when it hits the controller the id is 6.
cbruneAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
käµfm³d 👽Connect With a Mentor Commented:
Try:

...
data: "id=" + $id,
...

Open in new window

0
 
leakim971PluritechnicianCommented:
please provide a link to see your page
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.