I have this html:
<div class="box" id="n5">
<p class="text">Lorem ipsum dolor sit amet</p>
<textarea id="contentArea" rows="10" cols="50"></textarea>
<div class="more">LikeAlink</div>
</div>
and this jQuery function:
$(document).ready(function(){
$(".box .more").click(function(event){
$.ajax({
url : "test.txt",
success : function (data) {
$("#contentArea").html(data);
}
});
});
});
I found this solution on the Internet as an example. Why does it not work for me? I use Chrome, but the example worked on this browser.
Content does not not appears in the text box. Example
edit:
I have this error message in the console:
XMLHttpRequest cannot load file:///C:/wamp/www/test.txt. Origin null is not allowed by Access-Control-Allow-Origin
edit #2:
for those interested, it seems to be a problem in Chrome on local servers. To test, start Chrome with this argument
--disable-web-security
chrome.exe --disable-web-security