user3011784
user3011784

Reputation: 839

jQuery .load function not working

I'm using a simple .load() function from Jquery and I can't seem to make it work. Nothing happens when I click my DIV. My alert TEST does work.

<div class="ing">CLICK HERE</div>
<div id="overlay3-content"></div>


<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script type="text/javascript">

   $(document).on('click', '.ing', function(e){
      $("#overlay3-content").load('content.html');
    // window.alert("test");  THIS WORKS
    });

</script>

the page content.html just has the following:

<html>TEST TEST TEST</html>

JS FIDDLE: https://jsfiddle.net/37ukdrLf/

Any ideas

Upvotes: 0

Views: 2664

Answers (2)

Zulqarnain Jalil
Zulqarnain Jalil

Reputation: 1681

you are loading the model using either file:// or C:/, which stays true to the error message as they are not http://

So you can either install a webserver in your local PC or upload the model somewhere else and use jsonp and change the url to http://example.com/path/to/model

Answer taken from HERE

Upvotes: 1

Raj
Raj

Reputation: 980

try this:

$(document).on('click', '.ing', function(e){  
      $( "#overlay3-content" ).load( "content.html", function() {
        alert( "Load was performed." );
      });  
    });

Upvotes: 0

Related Questions