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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:01:52+00:00 2026-05-27T07:01:52+00:00

I used a Jquery truncator solution which is neatly written by Henrik Nyh to

  • 0

I used a Jquery truncator solution which is neatly written by Henrik Nyh to have a read more/less functionality. The script here

I wanted to modify this code to be able to keep track of read/unread status by updating database. I worote the code that does the database update in a webservice as follows.

[WebMethod]

public void updateReadStatus(int ID)
{
//code to update the database
}

I added the following to consume the webservice in the Jquery

    function updateStatus(){
            $.ajax({
                type: "POST",
                url: "WebServices/myWebService/updateReadStatus",
                data: "{'ID': " + $("#lblID").Text + "}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: OnSuccess,
                error: OnError
            });

function OnSuccess(reuslt) {
              alert(result.d);
            }

function OnError(result) {
              alert(result.status + ' ' + result.status);
            }
        }

//and i called this function on this line 

  full_node.find('a:last').click(function() {
  truncated_node.show(); updateStatus(); full_node.hide(); return false;

 //The user control that im using this scrip on has a repeater that contains a div that contains the paragraph to be truncated.

 <div class="readmore">
 <%# Eval("Message_Text")%>
 <asp:Label ID="lblID" runat="server" visible="false"
 </div>

The truncate script works fine and it gave me the functionality i want, read more/less. But i am not able to get the added functionality i wanted. I am getting “12030 unknown” error, i believe the problem is in the line data:

"{'ID': " + $("#lblID").Text + "}", 

how can I bring the value of the parameter ID from the text value of the lable to pass it to the webservice?

  • 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-27T07:01:53+00:00Added an answer on May 27, 2026 at 7:01 am

    text is a function, not a property, so you need to call it with ():

    "{'ID': " + $("#lblID").text() + "}", 
    

    Also, if you want to call a given WebMethod via Ajax, you’ll need to decorate it with the [ScriptMethod] attribute.

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

Sidebar

Related Questions

I have used Jquery for rounded corners (DIV) and i have a updatepanel which
I've used JQuery dialog to open a popup which contains image <script type=text/javascript> jQuery(document).ready(
I have used JQuery for a small animation work: a table #photos contains 9
I have not used jquery much yet and not very familiar with it. Trying
I have used JQuery within my asp.net page. JQuery is working fine. I could
I have used jQuery ready slider by: http://www.jeremymartin.name/projects.php?project=kwicks I now need to put overlay
I have used jQuery plugin: Validation To validate some input fields, but I need
I have used jQuery's jqrte text editor, but it has many drawbacks. Could anyone
I used jquery live search for live search. I have this html. A list
I have used jQuery library to find out height of a div . Below

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.