I am reading content of a local file using jquery
and I get undefined
.
I feel the problem is related to synchronization of URL loading. But I don't have any idea about how to fix this code:
function url_content(url)
{
var content;
$.get(url,function( data ) {content=data});
return content;
}
var content=url_content("local_templates/template1.html");
alert(content);
See Question&Answers more detail:os