Solved

Id in the controller is wrong value after ajax post.

Posted on 2013-01-20
2
202 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
Comment Utility
please provide a link to see your page
0
 
LVL 74

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
Comment Utility
Try:

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

Open in new window

0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now