Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 213
  • Last Modified:

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.
0
cbrune
Asked:
cbrune
1 Solution
 
leakim971PluritechnicianCommented:
please provide a link to see your page
0
 
käµfm³d 👽Commented:
Try:

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

Open in new window

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now