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 7988805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:33:52+00:00 2026-06-04T12:33:52+00:00

I have been trying to get a jquery ajax function to return data from

  • 0

I have been trying to get a jquery ajax function to return data from an orchard controller but so far I have not been successful. I have a break point set on the Controller but the code never reaches the controller.
Here is the JQuery function

<table id="tblResults" class="tablesorter">
    <thead>
       ...
    </thead>
    <tbody>
        @foreach (dynamic item in Result)
        {
          <tr>...</tr>
                }
    </tbody>
</table> 
<input id="__requesttoken" type="hidden" value="@Html.AntiForgeryTokenValueOrchard()" />

@using (Script.Foot())
{
    <script type="text/javascript">
        //<![CDATA[
        $(function () {
            $("#tblResults").tablesorter();
            setInterval(update, 20000);
        });
        function update() {
            $.ajax({
                type: 'POST',
                url: '@Url.Action("GetResults", "ResultsController", new { area = "Orchard.App" })',
                data: { token: $("#__requesttoken").val() },
                success: function (response) {
                    alert(response);
                },
                error: function () {
                    alert('error');
                }
            });
        }
        //]]>
    </script>
}

And For the ResultsController I just have this

[OutputCache(Duration = 0)]
public JsonResult GetResults()
{
   var json = DateTime.Now.ToString();
   return Json(json, JsonRequestBehavior.AllowGet);
}

NOTE: The Ajax call executes just fine however it never hits the break point set at “GetResults” and the http post url I see is “http://localhost:30320/OrchardLocal/&#8221;
Also, what I get for the response is the entire HTML Page.
Thanks in advance

  • 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-04T12:33:54+00:00Added an answer on June 4, 2026 at 12:33 pm

    Drop Controller after Results: “Results”, not “ResultsController”. Also, you’ll need to include the anti-forgery token in that post. Oh, and setInterval is evil.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to get this android service working but I can not
I have been trying to add data from my ajax query that returns json
i've been trying to login through AJAX but somehow its not working. my controller
I am trying to use jquery ajax to get data from a php file.
I have been trying all afternoon to get the jQuery Sifr Plugin ( http://jquery.thewikies.com/sifr/
I've been trying to get a better grasp on jQuery and have been coming
I have been trying to get this to work with several tutorials/answers here, but
I have been trying to get a simple example of the jquery-ui autocomplete to
I am very new to javascript and ajax/jquery and have been working on trying
I've been trying to get this really simple example of using AJAX with JQuery

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.