Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8125273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:45:49+00:00 2026-06-06T06:45:49+00:00

In my MVC3 app, I’m using $.ajax to call a method of type JsonResult

  • 0

In my MVC3 app, I’m using $.ajax to call a method of type JsonResult to get data to be displayed:

 function GetData(e) {
    var ordersId = e.row.cells[0].innerHTML; //this is fine
    $.ajax({
         type: "POST",
         url: "/Documents/GetDocumentData",
         contentType: "application/json; charset=utf-8",
         data: "{'id': '"+ordersId +"'}",
         dataType: "json",
         success: function (result) {
        //load window
         },
         error: function (result) {
            if (!result.success)
        //show error
         }
     });

This is my Action:

   [HttpPost] 
        public JsonResult GetDocumentData(string id)
    {
           //my code
           return Json(new { success = true});

        }

When im debugging on my development machine, it works fine. I deployed it to my test web server and i get ‘404 page not found dev/testwebsite/Documents/GetDocumentData’ I should get this when debugging if something was wrong, but i dont. Why am I getting this error? Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T06:45:50+00:00Added an answer on June 6, 2026 at 6:45 am

    Your URL in the javascript is wrong, if that dev/testwebsite/Documents/GetDocumentData is the URL on the server.

    You should be using @Url.Action() to automatically form those URLs in the cshtml page.

    Example:

    @Url.Action("actionName","controllerName"  )
    

    So, for your specific case, it would be:

    @Url.Action( "GetDocumentData", "Documents" )
    

    In the javascript, it would look like this:

    function GetData(e) {
        var ordersId = e.row.cells[0].innerHTML; //this is fine
        $.ajax({
            type: "POST",
            url: '@Url.Action("GetDocumentData","Documents")',
            contentType: "application/json; charset=utf-8",
            data: "{'id': '"+ordersId +"'}",
            dataType: "json",
            success: function (result) {
            //load window
        },
        error: function (result) {
            if (!result.success)
            //show error
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a simple mvc3 app using jqgrid. My form currently calls a function
I have an MVC3 app. I make a call to a database, get my
This is an MVC3 app. I have the following javascript call to my action:
I'm using the following code to create an audit trail in an MVC3 app.
In an MVC3 app, i have the following View: @using (Html.BeginForm(Index, Search, new {query
I have an MVC3 app, using EF, where one table winds up in a
I have an MVC3 app using Autofac and a custom membership provider. If I
I am building a MVC3 app using Ninject framework. I have a service that
I have an MVC3 app using the telerik's grid control. I'm populating the grid
When creating a new asp.net mvc3 app you get the logon and register form

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.