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

110
Views
How to load content of a UIkit modal asynchronous?

I want to show users our privacy text in a modal. The link which triggers the modal is in the footer - so on every page. The content comes from our own API endpoint like this: https://www.example.com/api/v1/legals/privacy

This is my current modal using UIkit (getuikit.com):

<a href="#modal-privacy" uk-toggle>Show Privacy Text</a>

<div id="modal-privacy" class="uk-modal-container" uk-modal>
    <div class="uk-modal-dialog" uk-overflow-auto>
        <button class="uk-modal-close-default" type="button" uk-close></button>
        <div class="uk-modal-header">
            <h2 class="uk-h3 uk-modal-title">Privacy</h2>
        </div>
        <div class="uk-modal-body">
          <?php
                  $response = file_get_contents( 'https://www.example.com/api/v1/legals/privacy');
                  echo json_decode($response);
          ?>
        </div>
        <div class="uk-modal-footer">
            <p class="uk-text-right"><button class="uk-button uk-button-default uk-modal-close" type="button">Close</button></p>
        </div>
    </div>
</div>

The problem with my current solution is that the content is loaded by PHP which blocks the rendering of the page and with that affecting the performance of the website. How can I load the content of the modal when opened instead of the initial page view?

Any help appreciated! I can't write Javascript so a working snippet would be great! ๐Ÿ˜Š

Greets

about 4 years ago ยท Juan Pablo Isaza
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!