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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:12:02+00:00 2026-05-25T03:12:02+00:00

In ASP.NET MVC 3 application I use Ajax.BeginForm to post writed text to controller.

  • 0

In ASP.NET MVC 3 application I use Ajax.BeginForm to post writed text to controller.

@using (Ajax.BeginForm("Post", "Forum", new {threadId = Model.Thread.Id  }, new AjaxOptions { OnSuccess = "PostReply" }))
{
    <div id="reply-area">
        <h3 style="border-bottom:1px solid black">POST REPLY</h3>

        <span id="post-error" class="error-message"></span>
        <textarea rows="1" cols="1" id="post-textarea" name="Content">    </textarea>

         <input type="submit" class="button" value="Submit"/>

     </div>
}

In controller I have

 [HttpPost]
 public ActionResult Post(int threadId,PostModel model)
 {
     bool Success = false;
     if (ModelState.IsValid)
     {
        Success=Unit.ForumFacade.CreatePost(Unit.ForumFacade.GetThreadByID(threadId), model.Content,  CurrentUserId);
        if (Success == true) return View("PostSuccess");
    }

    return Json("fsdfds");
}

And in javascript I have this

function PostReply(isRequestSuccessed) {
    alert("asdasd");
    if (isRequestSuccessed==false) {
        $("#post-error").html("Please Try Again");
    }
    else
    {
        $("#post-error").html("");
    }
}

The problem is that Javascript’s function doesn’t firing and isntead the alert, my browser(Firefox) returns me pop-up to download application/json file.
What is wrong here?

  • 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-05-25T03:12:03+00:00Added an answer on May 25, 2026 at 3:12 am

    Make sure you have included the following script to your page:

    <script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")" type="text/javascript"></script>
    

    and that you have enabled unobtrusive javascript in your web.config:

    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    

    This is what makes Ajax.* helpers such as Ajax.BeginForm to work.

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

Sidebar

Related Questions

I have an asp.net mvc application and i need to to use ajax in
I am using the ASP.NET Client-Side ajax control toolkit in my asp.net MVC application.
We are starting a new ASP.NET MVC application and want to use an jQuery
For my ASP.NET MVC 2 application I use Entity Framework 1.0 as my data
I'm writing an ASP.NET MVC application and trying to use a RESX file to
I am developing an ASP.NET MVC application and I want to use OpenId. What
I'm trying to use route constraints in an Asp.Net MVC Application. routes.MapRoute( theRoute, MyAction/{page},
I am about to use linqtosql in my first asp.net mvc application. I have
I'm looking to use NVelocity in my ASP.NET MVC application, not as a view
I want to use an IFrame in my ASP.Net MVC application, yet I want

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.