Hi there I'm still quite new with jQuery. I have a html file which contains a span that I would like to fetch and populate from a file on server. Here is my HTML file:
<div class="home-page main">
<section class="grid-wrap" >
<header class="grid col-full">
<hr></hr>
<p class="fleft">首頁</p>
</header>
<div class="grid col-one-half mq2-col-full">
<span class="Welcome_Message"></span>
</div>
</section>
</div>
Then here is my jQuery script file:
$.get('texts/Welcome_Message.txt', function(data) {
$('.grid span').html(data);
}).done(function() { alert("success"); })
.fail(function() { alert("error"); });
I've tried with the preview in DreamWeaver and it will populate and show the alert("success");
message properly. However running it in a browser (no matter which one) shows the alert("error");
and the span is not populated. Anyone can help please?