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

233
Views
Why isn't my button loading external page data into div?

I have an issue with AJAX.

I am using Safari version 12.1.

This is my code:

<!DOCTYPE html>

<html lang="en">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8">
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="description" content="">
        <meta name="author" content="">
        <meta rel="icon" href="assets/images/favicon.ico">
        <title>Test</title>

        <!-- Custom CSS -->
        <link rel="stylesheet" href="assets/css/style.css">

        <!-- GoogleFonts -->

        <!-- HTML5 shiv and Respond.js IE8 support of HTML5 elements and media queries -->
        <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
        <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
        <![endif]-->

    </head>

    <body>
        <div id="div1"><h2>Let jQuery AJAX Change This Text</h2></div>

        <button>Get External Content</button>


        <!-- Imported JavaScript libraries -->
        <script src="assets/js/jquery-3.6.0.js"></script>
        <script src="assets/js/jquery.fullpage.js"></script>

        <!-- test Javascript files -->
        <!--<script src="assets/js/test.js"></script>-->

        <script>
            $("button").click(function(){
              $("#div1").load("ajaxload.html", function(responseTxt, statusTxt, xhr){
                if(statusTxt == "success")
                  alert("External content loaded successfully!");
                if(statusTxt == "error")
                  alert("Error: " + xhr.status + ": " + xhr.statusText);
              });
            });
        </script>

    </body>

</html>

This is the code for the ajaxload.html page

<h1>Portfolio</h1>

<p>Congratulations you have loaded content from an external page</p>

For some reason I keep on getting the error message.

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!