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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:20:48+00:00 2026-05-31T02:20:48+00:00

I am simply looking to call a function when a form is loaded via

  • 0

I am simply looking to call a function when a form is loaded via ajax. My current code looks like this:

$('form').live("load",function() {...}

My ajax call looks like this:

jQuery.ajax({

                type: "get",
                url: "../design_form.php",
                data: "coll=App_Forms&form=Step_1_Company_Sign_Up",
                dataType: "html",
                success: function(html){                
                            jQuery('#Right_Content').hide().html(html).fadeIn(1000);

                }   

        })

I know that i could put my call inside the success portion of the ajax call but i am trying to minimize code and resuse other codes so i would really like to use the live feature.

I am loading a form via ajax and when that form is loaded i want to trigger a function using the jquery live. This works fine when i set it to “click”

$('form').live("click",function() {...} 

but it is unnecessary to run this function on every click, i just need it to run once on the form load so that is why i want to use the load listener not the click.

Thank you.

  • 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-31T02:20:49+00:00Added an answer on May 31, 2026 at 2:20 am

    Edit: I think you wanted to have custom code inside success callback which will be used in different pages so you don’t want to duplicate the same ajax call in different pages. If so, then you should call a function inside that success callback and implement different version of that in different page.

        jQuery.ajax({
                type: "get",
                url: "../design_form.php",
                data: "coll=App_Forms&form=Step_1_Company_Sign_Up",
                dataType: "html",
                success: function(html){                
                      jQuery('#Right_Content').hide().html(html).fadeIn(1000);
                      afterFormLoad(); //Implement this function 
                }   
    
        });
    
        function afterFormLoad() { } //dummy function defined in the common code
    

    And in your specific page,

        function afterFormLoad () {  
            //this is from page 1
        }
    

    Below just shows you about .live/.die and .one incase if you want to understand how to unbind it using .die.

    You can unbind .live inside the click handler using .die,

    DEMO

    $('form').live("click",function(e) {
        alert('clicked');
       $('form').die('click'); // This removes the .live() functionality
    });
    

    You can use .one if you are using jQuery 1.7. See below code,

    DEMO

    $(document).one('click', 'form', function() {
        alert('clicked');
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking to simply pull some quoted text out of a function call and
I am looking over this piece of code, and am having trouble with the
The second click function of this script doesn't work, I think it's simply a
I have an ajax function in home.php that give me back this html response
I have a class hierarchy that can be simply put like this: struct Parent
I am simply looking for a way of using drag and drop without jquery
I'm looking for a tool that simply tests a web server which I developed
Simply, I'm just looking to get a list of connected remote disks. I have
I'm looking for a plugin or way to simply go from any namespace, type,
I am looking for a XSL snippet that simply returns the XML unaltered. It

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.