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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:23:08+00:00 2026-05-28T15:23:08+00:00

I am developing an app in asp.net in which I have jquery code in

  • 0

I am developing an app in asp.net in which I have jquery code in my asp page

var strdata = {
           problemID: $("#problemID").val(),
           commentText: $("#_1").val(),
           empID: $("#empID").val(),
           agree: 0,
           disagree: 0
        };
        $.ajax({
            type: "POST",
            url: "<%= Url.Action("PostComment", "Discussion")  %>",
            data: strdata,
            dataType: "JSON",
            success: function (msg) {
                if ( msg == 1)
                alert("Success" + msg );
            }
        });

and my controller has code

  public bool PostComment(string problemID, string commentText, string empID, string agree, string disagree)
        {


            return _discussionRepository.postComment(Convert.ToInt32(problemID), commentText, Convert.ToInt32(empID), Convert.ToInt32(agree),Convert.ToInt32( disagree));
        }

and model has code

public bool postComment(int problemID, string commentText, int empID, int agree, int disagree)
        {
            bool result = false;
            Comment c = new Comment();
            c.ProblemID = problemID;
            c.CommentText = commentText;
            c.EmpID = empID;
            c.Agree = agree;
            c.DisAgree = disagree;

            _objectModel.Comments.InsertOnSubmit(c);
            try
            {
                _objectModel.SubmitChanges();
                result = true;

            }

            catch (Exception ex)
            {
            }


            return result;  

}

Data is saving in database through ajax and jquery but the success message is not showing

  • 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-28T15:23:10+00:00Added an answer on May 28, 2026 at 3:23 pm

    If the alert is not running with or without the condition that means the datatype being returned is not the datatype the $.ajax function is expecting.

    2 ways to get to the bottom of it:

    • First open up chrome or firebug and check out the network traffic. If you are getting the result back (the request is being made and the content looks accurate) then your data type is definitely the cause. Try changing the datatype in the request.

    • Next you could try adding functions other than just success. There is also error, status codes (404,500 etc), beforeSend, etc check the docs.

    There are other ways as well :). Fiddler might help too.

    • 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 App, which use EF code First, for some reason
I am currently developing an asp.net web app. I have a class which is
I am developing web app using asp.net. I have plenty of javascript files which
So I have been developing a small ASP.NET web app in C# for my
I have a project (Web Application) which I have been developing in C#/ASP.NET, and
I am developing an asp.net web app in which I am using a span
I am developing an asp.net MVC web app in which I am using Linq
I'm currently developing an app using ASP.NET MVC3 and Entity Framework 4.1 Code First
We are developing JQuery Mobile app using RC1 + ASP.NET MVC3. My question is:
I am developing a web app using ASP.NET 2.0 (C#), where on home page

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.