Подскажите. Воспользовался плагином jquery address
, url меняется но ajax load
не происходит. Подскажите, какая ошибка в коде? Заранее спасибо!!
<script type="text/javascript">
var init = true,
state = window.history.pushState !== undefined;
// Handles response
var handler = function(XMLHttpRequest, textStatus) {
var data = $.parseJSON(XMLHttpRequest.responseText);
$.address.title(data.title);
$('.container').html(data.content);
};
$.address.state('/myprogect/').init(function(event) {
// Initializes the plugin
$('a').address();
}).change(function(event) {
var value = $.address.state().replace(/^\/$/, '') + event.value;
// Selects the proper navigation link
// Selects the proper navigation link
$('a').each(function() {
if ($(this).attr('href') == value) {
$(this).addClass('selected').focus();
} else {
$(this).removeClass('selected');
}
});
if (state && init) {
init = false;
} else {
// Loads and populates the page data
$.ajax({
cache: false,
complete: handler,
url: value
});
}
});
if (!state) {
// Hides the page during initialization
document.write('<style type="text/css"> body { display: none; } </style>');
}
</script>