I am using jquery address plugin for loading pages, but without hash(#).
index.html:
<a href="page.html">Link</a>
<div id="content">
<script>
$(document).ready(function() {
$.address.init(function(event) {
$('a').address();
}).change(function(event) {
// do something depending on the event.value property, e.g.
console.log(event.value);
$.ajax({
type: "POST",
url: event.value,
success: function(msg){
$('#content').html( $(msg).find("#content").html() );
}
});
});
$('a').click(function(e) {
$.address.value($(this).attr('href'));
});
});
</script>
</div>
page.html:
<div id="content">
<p>text</p>
<script>
$(document).ready(function() {
alert('loaded');
});
</script>
</div>
In #content div will be loaded #content html from page.html(maybe i should use other function, not .html(), correct me please), in that div is script tag, but i dont get alert when that page is loaded from ajax, it works on without ajax loading.
Can someone help me ?
EDIT:
I am getting this error when i'm trying to click on link with js function:
XMLHttpRequest cannot load javascript:;. Cross origin requests are only supported for HTTP.
DEMO: http://fbstatusi.com/desavanja/kalendar/mesecna_lista
click on link Zurka 123
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…