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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:19:45+00:00 2026-05-11T19:19:45+00:00

i have a question in JQuery..I m using $.ajax() in my code (Function 1)

  • 0

i have a question in JQuery..I m using $.ajax() in my code (Function 1)to send the fieldname and the sequence number to the ctrller which gets its data by $_POST['name'] and $_POST['sequenceno'] and updates the fieldname in the table with sequence no given..And generates the Preview Display Panel with the inserted fields ..
Now I’m trying the change the field name again tat is Now when I click on the generated display panel fields, the corresponding settings will open and i will try to change the name of the field now(Function 2)

Both Function1 and Function2 are same ..In the Function1 I’m sending the fieldname and the sequence no

In the Funciton 2,i want to send the same fieldname and (but the other value)sequenceno..

But in Function1 (sequenceno is the counter value)
Whereas in the Function2 (sequenceno is the clicked div id (display Panel))

How can i make use of the same func for both ..Or could i need to use separate funcs..

Even i tried with 2 separate funcs with different urls but not updated correctly

My code is

    //This is what i insert the field initially

              $(".TextFieldSettings #fieldTitle").change(function (){
             fieldname=$(".TextFieldSettings #fieldTitle").val();
    $.ajax({
           type: "POST",
           url: "./server",
        data: "name="+fieldname+"&sequenceno="+counter,

                success: function(msg){
                      }//success
           });//ajax

     });//change

//After inserting to get the updated values in JSON format

     var htm = $.ajax({
       type: "GET",
          url: "./viewforms",
         async: false
       }).responseText;
        var myObject = eval('(' + htm + ')');


    gettype=myObject.attributes[0]["type"];
   getlabel=myObject.attributes[0]["labels"];

    //showing in my DisplayPanel view

            $("#labelstr"+counter+"").html(getlabel);
     });//change

Now
When i click the DisplayPanel view

      $("#displayPanel div").live("click", function(){
                             div_id=$(this).attr("id");

                                var htm = $.ajax({
                                  type: "GET",
                                  url: "./getattributes/"+div_id+"",
                                  async: false
                                 }).responseText;
                                var myObject = eval('(' + htm + ')');


                                gettype=myObject.attributes[0]["type"];
                                getlabel=myObject.attributes[0]["labels"];
                                getsize=myObject.attributes[0]["size"];

    if(gettype=='Text')
     {
    $(".TextFieldSettings").show(function(){
    $(".TextFieldSettings #fieldTitle").val(getlabel);//showing the updated value
                             if(getsize=='100')
                           {
             $("#fieldSize option:contains(Small)").attr("selected",true);
                           }
                             else if(getsize=='200')
                            {
        $("#fieldSize option:contains(Medium)").attr("selected",true);
                         }
              else 
            {
          $("#fieldSize option:contains(Large)").attr("selected",true);
            }
//Again i m changing the fieldname


       $(".TextFieldSettings #fieldTitle").change(function (){
      fieldname=$(".TextFieldSettings #fieldTitle").val();


                                alert(div_id);
                                        $.ajax({
                                           type: "POST",
                                           url: "./editsettings",



                                                                         data: "name="+fieldname+"&sequenceno="+div_id,
                                           success: function(msg){

                                            }//success
                                           });//ajax


});//change in text value later*/



                    });//show
                    }//if type = TEXT

                });//displaypanel Div clicked

But now if I try to change the fieldname again I’m writing another POST function editsettings but the execution comes inside Func1(changing initially) instead of Func2(changing in the fieldname again)…
Please anyone get out the answer for this….
Note:
$(".TextFieldSettings #fieldTitle").change() is used twice inside my prg ..May be because of this the updation goes 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-11T19:19:45+00:00Added an answer on May 11, 2026 at 7:19 pm

    It seems like the problem is that both of your event handlers are firing, and you only want the latter one to fire.

    The jQuery .change() function adds an event handler to the change event. It doesn’t replace existing ones. If you want to remove the previous handler, you need something like:

    $(".TextFieldSettings #fieldTitle").unbind('change') 
    

    before you attach a new handler.

    please note that I’m not sure this works (I just found it from the api docs) and I can’t test it right now. However, the general idea is that if you want an event handler to stop responding to an event, you have to remove the handler.

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

Sidebar

Ask A Question

Stats

  • Questions 218k
  • Answers 218k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Question 1 The s parameter binds ":" to whatever value… May 12, 2026 at 11:33 pm
  • Editorial Team
    Editorial Team added an answer No, it does nothing in itself. It's up to you… May 12, 2026 at 11:33 pm
  • Editorial Team
    Editorial Team added an answer You will be storing the path of the msg file… May 12, 2026 at 11:33 pm

Related Questions

I'm using the hoverIntent Jquery plugin and I have a question regarding callback functions.
I'm using jQuery and I have a function that serves as an event callback,
In my test document I have a few classes labeled item, currently I'm using
I'm using the jQuery toggle effect hooked to the click() event of 1 table

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.