Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

94
Views
Load page without refresh

I have this script in the head:

<script>
    $(document).ready(function() {
        $('#nav a').click(function(e) {
            e.preventDefault();
            $('#content').load($(this).attr('href'));
        });
    });
</script>

On this part of script

   <div class="dropdown-menu" id="nav">
      <a href="../exercises/match_pinyin.php" class="dropdown-item" >Profile</a>

it work fine. Which means it load the php page without refresh the whole page.

Now I need to make it work with

       <div id="submenu-2" class="collapse" id="nav">
            <ul class="nav nav-small flex-column">

              <li class="nav-item">
                <a class="nav-link" href="../exercises/match_pinyin.php">Γραπτές Ασκήσεις</a>
              </li>

              <li class="nav-item">
                <a class="nav-link" href="pages-utility.html">Utility Pages</a>
              </li>

              <li class="nav-item">
                <a class="nav-link" href="pages-layouts.html">Layouts</a>
              </li>

            </ul>
          </div>

I also tried the below, but it load the page on a new one.

<script>
    $(document).ready(function() {
        $('#nav ul li a').click(function(e) {
            e.preventDefault();
            $('#content').load($(this).attr('href'));
        });
    });
</script>

Any idea how can I make it work?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

$('#nav a, .nav-link').click did the trick and it looks good now.

Thank you

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!