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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:32:00+00:00 2026-06-16T01:32:00+00:00

I have a page in which I refresh a DIV by a JQUERY Ajax

  • 0

I have a page in which I refresh a DIV by a JQUERY Ajax call, but I then lose al the javascript code that I included in the “head” page. Do I need to include them twice? Looks to me that’s not good for the performance, because you have to load the javascript again while it is on the client page already. How to include the files so that they are also available after Ajax refresh

$(document).ready( function() {
    $("#prijzen_huidige_jaar").submit(function(event) {    
    /* stop form from submitting normally */    
    event.preventDefault();      
    $.ajax({
    type:"POST",
    url:"prijzen_huidige_jaar_test.php",
    cache: false,                   
    data: $("#prijzen_huidige_jaar").serialize(),
    success:function(data){
        $("#test").replaceWith(data);
    }       
});
});
});

include in the main page:

<script type="text/javascript" src="https://localhost/include_bestanden/javascript/prijzen.js"></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-06-16T01:32:02+00:00Added an answer on June 16, 2026 at 1:32 am

    Instead of using click in your JS, you should use on with class identifiers, as this will apply to elements added later via AJAX.

    So instead of:

    $("input[name$='vraag_afwijkende_prijzen']").click(function(){          
        if($(this).val() == 1){
            $("#instructie_afw_prijzen_tekst").html(vraag4_ja);
            $("#afwijkende_prijzen_vak").show('slow');
            $("#afwijkend_1").show('slow');
        }
        //etc
    

    Try something like:

    $(document).on("click", ".vragen-radio", function() {
         if ($(this).attr("name") == 'vraag_afwijkende_prijzen' && $(this).val() == 1) {
            $("#instructie_afw_prijzen_tekst").html(vraag4_ja);
            $("#afwijkende_prijzen_vak").show('slow');
            $("#afwijkend_1").show('slow');
         }
         //etc
    

    You can read about it in this question: Why use jQuery on() instead of click()

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

Sidebar

Related Questions

I have a page which loads and then I do some JQuery upon it.
I have a page which reloads a DIV with AJAX every 5 seconds. I
I had a home page which have a few tables that refresh itself every
index.php has this jquery code which loads notifications.inc.php into a div on the page
I have a div which is centred on the page that contains text loaded
I have done pagination in wordpress with Jquery/Ajax/wp_pagenavi() which instead of reloading page refreshes
I have a page in which I have a div. The content from that
I have a statistics page which has a meta refresh tag on it. <meta
I have taken a jQuery script which would remove divs on a click, but
I have a PHP page which has a div, the div has a PHP

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.