このスクリプトは私には機能しません。
問題が.on('value')
関数にあることは知っていますが、それが何であるかはわかりません。
これは私のスクリプトです:
$(document).ready(function(){
//dynamic content switching inside the content section
function writeContent(page){
//setting post to default error message
var post = "Sorry, This page is undergoing maintenance.";
//firebase data reference for the clicked link's content
var dataRef = new Firebase("https://cityartist.firebaseio.com/"+page);
//inserting the available content to the 'post' variable
dataRef.on("value",function(snapshot){
if(snapshot.val() != null){
post = snapshot.val();
alert("post="+post);
}
});
//showing content in the content section and changing the page's title
$("#content").append("<article class='post'><p>"+post+"</p></article>");
$("title").text("CityArtist.org - "+page);
}
//switching pages using the navigation bar
$(".menu_link").click(function(){
writeContent($(this).attr("name"));
});
});