几乎整天,我一直在追捕我的大理,寻找大 go,看不到为什么不工作。 作为改进我自己的网站的一项实验,我正在检查以下的辅导:http://tuliczine.com/2009/09/simple-ajax- website-jquery/>http://tuliczine.com/2009/09/simple-ajax- website-jquery/ >。 最为重要的是,Ajax/jquery科。
基本上,这部教学法的页数是页数,但我却试图将其改用页数。 因此,从小里夫和实验室那里可以把它作为“家庭.html”和装入内容部分。 出于我之外的原因,这只是不会奏效。 我要说一下,我试图修改法典一的相关部分,以便:
从javascriptloader(只有我修改的结尾部分):
var datastring=url.replace( #! , ); //strip the #page part of the hash and leave only the page number
$( #loading ).css( visibility , visible ); //show the rotating gif animation
$.ajax({ //create an ajax request to load_page.php
type: "POST",
url: "load_file.php",
data: datastring, //with the page number as a parameter
dataType: "html", //expect html to be returned
async: false,
success: function(msg){
if(parseInt(msg)!=0) //if no errors
{
$( #content ).html(msg); //load the returned html into pageContet
$( #loading ).css( visibility , hidden ); //and hide the rotating gif
}
}
});
And the entire php file:
<?php
$url = $_POST[ datastring ];
if(file_exists( .$url. .html ))
echo file_get_contents( .$url. .html );
else echo There is no such page! ;
?>
I wanted to learn on my own and figure this out but honestly I don t get it :/ There s no cross domain problem as far as I can tell. Anybody know what I m missing? Figured I d ask here since it s likely to be more traveled than that tutorial s site, although if I find a solution I ll go over there and post it in the comments too so others may avoid my pain. XD