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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:31:35+00:00 2026-05-25T20:31:35+00:00

I am developing a control panel for a project, and I am having a

  • 0

I am developing a control panel for a project, and I am having a bit of a conflict with some of my code. I am running some jQuery so that every link will insert the content of the requested page into a DIV. This code is located in the index.php page, so it’s on first on the page to be run, no matter what. You never actually navigate away from the index.

$('a').live("click",function(){
var external = $(this).attr('class');
if (external == "externalLink") {
return true;
}
var page = $(this).attr('href');
if (!(page == "#") && (page)) {
    $("#loading").fadeToggle("fast", "linear");
    $("#split-view-right #content").load(page, function(){
        var parentHeader = $("#split-view-right #content #parentHeader").html();
        $("#split-view-right #header").html(parentHeader);  
        $("#loading").fadeToggle("fast", "linear");
    });
}
return false;
});

In the #header, I also have some code being put there, including some buttons. Some of them I have just link to a page, which works great, but some I require to run a script. When I try to define a script to run on one of these pages, it will not find the button unless I run it with ‘.live’. The problem with that is, when I try to go to another page after it runs that live script, it ignores the hyperlink and runs that code again. Heres a sample of the code being run.

$(function() {
$("#headerbutton").live('click', function() {
    $("#loading").fadeToggle("fast", "linear");
    var title = $("input#title").val();
    var partnum = $("input#partnum").val();
    var descript = $("textarea#descript").val();    
    var startprice = $("input#startprice").val();
    var minprice = $("input#minprice").val();
    var domship = $("input#domship").val(); 
    var intship = $("input#intship").val();
    var startdate = $("input#startdate").val();
    var droprate = $("input#droprate").val();   
    var dataString = 'title='+title+'&partnum='+partnum+'&descript='+descript+'&startprice='+startprice+'&minprice='+minprice+'&domship='+domship+'&intship='+intship+'&startdate='+startdate+'&droprate='+droprate;    
    $.post("savenewproduct.php",
    { "title": title, "partnum": partnum, "descript": descript, "startprice": startprice, "minprice": minprice, "domship": domship, "intship": intship, "startdate": startdate, "droprate": droprate },     
    function(postdata){
        $("#split-view-right #content").load('upload_images.php?id=' + postdata.newID, function(){
            var parentHeader = $("#split-view-right #content #parentHeader").html();
            $("#split-view-right #header").html(parentHeader);  
            $("#loading").fadeToggle("fast", "linear");
        });
    }, "json");
    return false;
});
});

What I would like to try and do (unless there is a better solution) is to make it so each time I run a ‘.load’, I can run a ‘.die’ script to cancel out the previous live codes on that page.

Any ideas?

  • 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-25T20:31:36+00:00Added an answer on May 25, 2026 at 8:31 pm

    I’m not sure if I’ve understood your details enough, but here’s what I take from this.

    Firstly, it sounds like .one() would’ve saved your behind here, if not for the .live() requirement. If you can manage to refactor your code so that you can take advantage of .one(), that would be great.

    Barring that, why not just stick a .die() call on your .load() function’s callback? From what I can see, your code is basically:

    $('#headerbutton').live('click', function() {
        // some stuff
        $.post(foo, bar, function () {
            $("#split-view-right #content").load(herp, function () {
                 // some stuff
                 // some more stuff
                 // ...
                 // what's stopping you from doing something like this:
    
                 $('#headerbutton').die('click');
            });
        });
    });
    

    That would effectively cancel out the .live() handler on your #headerbutton.

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

Sidebar

Related Questions

I am developing a control that is a rectangle area and will draw an
I am developing my custom video control using jquery , javascript. for that i
I am developing a custom control that needs it's viewstate to be loaded on
I'm currently developing a custom control that derives from CStatic MFC class (Smart Device
I'm currently developing a Blog project using Post model, which will be used by
I'm developing a custom control that doesn't inherit from Button. I want to implement
i am developing application and i have set some html control which are runat=server
Background I am developing an ASP.Net server side control that needs to talk to
I'm having a problem with a user control I'm developing which contains a ListView
I have a widget in an ASP.NET project that I'm developing for my job.

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.