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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:29:53+00:00 2026-06-01T14:29:53+00:00

Jquery $(‘#PostComment’).click(function () { var commentTitle = $(‘#commentTitle’).val(); var commentClob = $(‘#commentClob’).val(); var id

  • 0

Jquery

$('#PostComment').click(function () {

             var commentTitle = $('#commentTitle').val();
             var commentClob = $('#commentClob').val();
             var id = $('#topicId').val();
             var buttoname = $('#PostComment').val();
             var obj;
             $.ajax({

                 type: "post",
                 url: "../../Handler/Topic.ashx",

                 data: "commentclob=" + commentClob + "&commenttitle=" + 
                        commentTitle + "&topicId=" + id + "&Button=" + buttoname,
                 success: function (msg) {

                     try {
                          alert(msg);
                         obj = jQuery.parseJSON(msg);
                         alert("Correct" + obj.CommentClob);

                     }
                     catch (e) {


                         alert("Incorrect" + e.Description + e.ErrorNumber);
                     }



                 }
             });

             return false;
         });
     });

Topic.ashx -ProcessRequest method

     CommentModel cm = daoobject.populateCommentModel(listcommentsbytopic);
     var json= cm.CreateCommentJson();
     context.Response.Write(json);

Function definition

     public string CreateCommentJson()
         {
            // serialize the names to JSON
            var jss = new JavaScriptSerializer();

            var json = jss.Serialize(this);
            return json;
        }

I am getting output 2 alert boxes

first is

 { "UserId": "1", "ToipicId": "44f94c32-c415-4751-812a-03b775775698", "CommentId": "0f1014a0-08d9-48f7-9a0c-d9d6b3d841b2", "CommentClob": "ilikeit", "CommentTitle": "nice", "DescriptionClob": null, "DateCreated": "/Date(1333233498780)/", "Datemodified": "/Date(-62135596800000)/" }

and second is

Incorrect undefined undefined

Can anyone help.

  • 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-01T14:29:54+00:00Added an answer on June 1, 2026 at 2:29 pm

    Your returned json is malformed. You should not be escaping all of the " as you are.

    Run your json response msg through http://jsonlint.com and then run this one through it.

    {
        "UserId": "1",
        "ToipicId": "44f94c32-c415-4751-812a-03b775775698",
        "CommentId": "0f1014a0-08d9-48f7-9a0c-d9d6b3d841b2",
        "CommentClob": "ilikeit",
        "CommentTitle": "nice",
        "DescriptionClob": null,
        "DateCreated": "/Date(1333233498780)/",
        "Datemodified": "/Date(-62135596800000)/"
    }
    

    Follow on:

    In your comments, you state that you are getting the first alert printed out. If you are getting it printed out as you say, then that shows that the data is still in string format and NOT already parsed as json. If it were already parsed as json, you’d be getting an [Object object] message instead of the actual text.

    That being said, check out this jsFiddle and this resulting screenshot of a Firebug breakpoint.

    This essentially shows that the .parseJSON() function will properly parse this new ‘json string’. From what you’ve given us, it tells me that you haven’t given us everything. You are doing something (possible typo?, more processing that isn’t getting posted?, something!) to that string (if in fact you are getting it as stated) before you parse it with JQuery.

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

Sidebar

Related Questions

jQuery: $(.upvote).click(function() { var id = $(this).attr('id'); var changeImage = ($(this).children('img').attr('src') === siteUrl +
jQuery(document).ready(function(){ $(#submitButton).click(function () { if ( $(#formToSubmit).validationEngine('validate') == true) { $(#formToSubmit).submit(); } }); I
jQuery.widget(ui.test,{ _init: function(){ $(this.element).click(this.showPoint); }, showPoint: function(E){ E.stopPropagation(); alert(this.options.dir); } } $('#someEleme').test(); Right now,
Jquery has a great language construct that looks like this: $(document).ready(function() { $(a).click(function() {
jQuery(document).ready(function(){ var panelContainer = jQuery('div#panels'); jQuery('<div id=tabs></div>').insertBefore(panelContainer); panelContainer.find('div.panel').each(function(n){ jQuery('div#tabs').append('<a class=tab href=#' + (n+1) +
Jquery Source : $.ajax({ type: 'get' , dataType: 'text' , url: 'navigation.html' , cache:
jQuery('td[class=bgoff]').each(function() { var td = jQuery(this); ... no apply selector to this only });
jQuery("body").dblclick(function(event){ var x = event.pageX - this.offsetLeft; var y = event.pageY - this.offsetTop; jQuery("<div></div>").addClass("node").css("position","absolute")
jQuery Code : (function($){ $.fn.jgtextdefault = function(settings){ var jElements = this; var settings =
jQuery(function($) { function fixDiv() { var $cache = $('header'); if ($(window).scrollTop() > 10) $cache.css({'position':

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.