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

  • Home
  • SEARCH
  • 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 8106097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:21:31+00:00 2026-06-06T00:21:31+00:00

I want to show data that returned from controller, in onComplete function: function onComplete()

  • 0

I want to show data that returned from controller, in onComplete function:

function onComplete() {
    alert(); //I want to show data that returned from controller in this.
}

here is ajax link:

@Ajax.ActionLink("Upvote", "Upvote", "Author",
new AjaxOptions
{
    InsertionMode = InsertionMode.Replace,
    UpdateTargetId = "vote_count",
    OnComplete = "onComplete",
})

And my controller:

public ActionResult Upvote(Guid QuestionID)
{
     return Content("Message");
}

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-06T00:21:33+00:00Added an answer on June 6, 2026 at 12:21 am
    function onComplete(result) {
        alert(result.responseText);
    }
    

    Or if you use the OnSuccess callback:

    @Ajax.ActionLink("Upvote", "Upvote", "Author",
    new AjaxOptions
    {
        InsertionMode = InsertionMode.Replace,
        UpdateTargetId = "vote_count",
        OnSuccess = "onSuccess",
    })
    

    you could:

    function onSuccess(result) {
        alert(result);
    }
    

    For example if your controller action returned a JSON result:

    return Json(new { foo = "bar" }, JsonRequestBehavior.AllowGet);
    

    in your Success callback you already get a javascript parsed object:

    function onSuccess(result) {
        alert(result.foo);
    }
    

    Notice that this is not the case with the OnComplete callback where you always get the XHR object as parameter and it is up to you to do the parsing and so on. Also notice that the OnComlpete callback is always executed, even if the AJAX call fails which obviously is not the case with the OnSuccess callback.

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

Sidebar

Related Questions

i want to show some data from DB. and i'm use ajax to do
i have created an application which show data from user current location. I want
I want to get data from table in MySQL and to show it in
I want to show data in this format, 12-22-2011 11:00:00 [12-22-2011 11:13:39] Warning: Contact
I'm using this code sample that came from jquery-ui website to show the dialog
Hello i want to show data from table where i have to show only
i have this jquery function that i want to pass topic parameter to, i
In the ASP.NET MVC Razor engine I want to show three data entries in
I want to show a custom image with some data in it while clicking
I've got a list of data in an observableArray and I want to show

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.