0

I changed some things around for an item that was requested. This required me to add a parameter to one of the controller ActionResults.

public ActionResult RejectDocument(int id = 0, string rejectReason)
        {
            IPACS_Version ipacs_version = db.IPACS_Version.Find(id);

            ipacs_version.dateDeleted = System.DateTime.Now;
            ipacs_version.deletedBy = User.Identity.Name.Split("\\".ToCharArray())[1];

            db.SaveChanges();

            return RedirectToAction("Approve");
        }

Also this link needs to be activated from jQuery after some jQuery items finish. How do I pass this link off now?

should it be href= Document/RejectDocument?id=222&rejectReason=this is my reject reason

could I then do window.location = href; and it would call the controller and pass in the correct information?

3
  • 1
    Did you try it? Is it not working for you in some way? Commented Sep 10, 2013 at 17:44
  • Could post your javascript code? Commented Sep 10, 2013 at 18:47
  • maybe you should think about using the post request instead of get Commented Nov 3, 2015 at 12:32

1 Answer 1

3

You could use the Url helper to create the right url using the table routes rules. For sample:

window.location = '@Url.Action("RejectDocument", "YourController", new { id = 222, rejectReason = "this is my reject reason" })';
Sign up to request clarification or add additional context in comments.

1 Comment

This worked for me although I didn't use @Url.Action, I just plugged in the href. Thank you! :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.