I'm trying to import the contents of a file (the file itself dosen't matter, html, php, text) - in all cases, I am unable to get any content loaded in. I've even used direct copy past off tutorials and it does not load or work?. I guess I'm missing something, or there is a version conflict maybe?.
HTML
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>test</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery("#new").load("new.html);
});
</script>
</head>
<body>
<div id="new"></div>
</body>
</html>
This code is taken directly from jQuery website, I've only changed the file being loaded to "new.html" and yes, I have that named file in the same directoy. I've tried both referencing the source from online, and using local jquery file, tried different browsers as well.
When testing, the browser shows a blank page, it's not displaying the text?.
Any ideas what I'm doing wrong?
Thanks,
You should do this instead of JQuery
$(document).ready(function(){
$("#new").load("new.html");
});
// OR
$(function(){
$("#new").load("new.html");
)};
And I would recommend using
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
The reason this wasn't working is that JQuery is deprecated (meaning it shouldn't be used and will error most of the time) you should use $ since it is not deprecated and is the new way to do it. Also you did load("new.html) you missed a extra "