Solved

Id in the controller is wrong value after ajax post.

Posted on 2013-01-20
2
207 Views
Last Modified: 2013-01-24
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
Comment
Question by:cbrune
2 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 38799401
please provide a link to see your page
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 38799402
Try:

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

Open in new window

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question