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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:47:40+00:00 2026-05-26T09:47:40+00:00

I’m trying to use Ajax of jQuery, I have this code below and although

  • 0

I’m trying to use Ajax of jQuery, I have this code below and although I get no error in firebug it’s not working, It seems the function in code behind doesn’t get any params.

(document).ready(function () {
        $("#S1").click(function 
            () {

            $("#t1").toggle("fast");
            $("#P1").toggle("fast");
            $("#S1").css("background-color", "White");
            var ID = $("#HiddenField1").attr("Value");
            var params = { 'Key': ID };
            $.ajax({
                type: "POST",
                url: "viewMessages.aspx/readen",
                data: params,                    
                dataType: "json"
            });
        });
    });

and here is the code behind

[WebMethod(EnableSession = false)]
public static void  readen(string Key)
{
    DBController db = new DBController();
    db.ReadenMes(Convert.ToInt32(Key));                
}

the code below work but since I wanna use it in IE 6 I have to use the code above.

 $(document).ready(function () {
 $("#S2").click(function 
     () {
     $("#t2").toggle("fast");
     $("#P2").toggle("fast");
     $("#S2").css("background-color","White");
     var ID = $("#HiddenField2").attr("Value");
     var params = new Object();
     params.Key = ID;
     var myJSONText = JSON.stringify(params);
     $.ajax({
         type: "POST",
         url: "viewMessages.aspx/readen",
         data: myJSONText,
         contentType: "application/json",
         dataType: "json"

     });
 });

});

where do you think i’m doing wrong?

  • 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-26T09:47:41+00:00Added an answer on May 26, 2026 at 9:47 am

    If your issue only is that IE6 has no JSON.stringify method, than you can use json2.js from Douglas Crockford and then your second sample should work as expected in IE6 too.

    $(function () {
      $("#S2").click(function 
         $("#t2").toggle("fast");
         $("#P2").toggle("fast");
         $("#S2").css("background-color","White");
         var ID = $("#HiddenField2").attr("Value");
         var myJSONText = JSON.stringify({ Key: ID });
         $.ajax({
             type: "POST",
             url: "viewMessages.aspx/readen",
             data: myJSONText,
             contentType: "application/json",
             dataType: "json"
         });
      });
    });
    

    Another approach is do not use ‘json’ datatype, and then params should be serialized as regular query string.

    $(function () {
      $("#S2").click(function 
         $("#t2").toggle("fast");
         $("#P2").toggle("fast");
         $("#S2").css("background-color","White");
         var ID = $("#HiddenField2").attr("Value");
         var params = { Key: ID };
         $.post("viewMessages.aspx/readen", params);
      });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I am trying to understand how to use SyndicationItem to display feed which is
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I am trying to loop through a bunch of documents I have to put
I have some data like this: 1 2 3 4 5 9 2 6

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.