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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T13:58:40+00:00 2026-05-21T13:58:40+00:00

I’m trying to call a server side method, using jquery, on the textchange event

  • 0

I’m trying to call a server side method, using jquery, on the textchange event of a textbox which is generated dynamically on the clientside (I dont know how to fetch the id of this). Can somebody help me to do this stuff? The script im using is as follows:

  <script type="text/javascript">

    $(init);

    function init() {

      $('#test').droppable(  //Div Control where i'll be dropping items
            {
              drop: handleDropEvent
            });

      $('a').each(function(idx, item) {   
        $(item).draggable({ cursor: 'move', helper: 'clone' })
      });
    }

    function handleDropEvent(event, ui) {
      var draggable = ui.draggable;
      document.getElementById('test').innerHTML += addColumn(draggable.attr('text')) + '<br>';
    }
    $('.textChangeClass').live('change', function() { 
/* Evokes on the text change event for the entire textboxes of class .textChangeClass. Is it possible to specify the dynamic textbox generated @ clientside here? (like for e.g. :  $('#mytextbox').click(function () ) */

    $.ajax({
      type: "POST",
      url: "Webtop.aspx/ServerSideMethod",         //This is not getting called at all.
      data: "{'param1': AssignedToID}",
      contentType: "application/json; charset=utf-8",
      dataType: "json",
      async: true,
      cache: false,
      success: function(msg) {
        alert("From Server");
      }
    })

    });

    });
    function addColumn(column) {

      var iHtml;

      //This is how i'm generating the textboxes along with a checkbox bound by a div.
      iHtml = '<div id="dv' + column + '" width="100px;" height="20px;" padding: "0.5em;">&nbsp;' + '<span title="ToolTipText">' + '<input type="checkbox" id="cb' + column + '" value="' + column + '" /> <label for="cb' + column + '">' + column + '</label></span><input class="textChangeClass" type="text" id="aln' + column + '">&nbsp;</div>';
      return iHtml
    }
  </script>
  • 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-21T13:58:41+00:00Added an answer on May 21, 2026 at 1:58 pm
    1. I think you have an extra “});” although this probably isn’t the problem.
    2. What is “AssignedToID”? Try adding single quotes around that. I seem to remember having a weird problem a couple years ago related to quoting in the json.
    3. Can you see the request in Fiddler/firebug/etc? Is the content correct?

    You should be careful of your use of inferred semi-colons too. If you ever minify your javascript (yeah, I know this is embedded, but I’d like to hope that one day it will be moved to a seperate js file) you’re eventually going to have a problem. Imagine some other developer comes along, does some refactoring and needs to add a return value after the ajax call.

    $.ajax({...})return foo}
    

    EDIT

    Fiddler/Firebug Net panel are your friends… They will allow you to inspect the request and the response from the server. This way you don’t have to add the error handler (although you may want to for other reasons eventually)

    EDIT

    To answer the other part of your question, you can access the textbox for which the change event was triggered through the use of the ‘this’ keyword inside of the event handler.

    $('.textChangeClass').live('change', function(event) {
        //Note that the 'event' parameter has interesting things in it too. 
        var changedText = $(this).val();
        alert("The value in the textbox is: '" + changedText + "'");
        var data = {
            param1: changedText
        };
        $.ajax({
            ...
            //Using json2 library here to create json string
            data: JSON.stringify(data), 
            ...
        });
    });
    

    Note that I added the optional ‘event’ parameter to the event handler. It has interesting things in it and it’s something that is often overlooked by people who are new to jQuery. Read about it here.

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

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm trying to select an H1 element which is the second-child in its group
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

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.