如何指定的元素,其中的內容是從下面的代碼PAGEURL內檢索時如何指定的元素?加載內容的jQuery AJAX
$(function() {
$("a[rel='sort']").click(function (e) {
//e.preventDefault();
/*
if uncomment the above line, html5 nonsupported browers won't change the url but will display the ajax content;
if commented, html5 nonsupported browers will reload the page to the specified link.
*/
//get the link location that was clicked
pageurl = $(this).attr('href');
//to get the ajax content and display in div with id 'content'
$.ajax({
url: pageurl + '?rel=sort',
success: function (data) {
$('#content1').html(data);
}
});
//to change the browser URL to 'pageurl'
if (pageurl != window.location) {
window.history.pushState({
path: pageurl
}, '', pageurl);
}
return false;
});
});
你在這裏檢索,成功:功能(數據)。它是一個json數據數組嗎? – Swarne27