0

I want to update the page content with JQuery ajax depending on the URL.

For example, if the url is /contact it will include the contact page without refreshing.

I have the .htaccess file which deals with the URL.

This is the JQuery that I have, but I don't think it's right for what I want to achieve.

$('#topBar .topBarElement').click(function() {
  var page = $(this).attr('href');
  $('#content').load('content/' + page + '.php');
  return false;
});
4

1 回答 1

1
<a href="/contact">Contact</a>

$("a").click( function(e) {
    e.preventDefault();
    $("body").load($(this).attr("href"));
});

不是我推荐它..它还需要调整以删除标题、重复脚本和其他要考虑的事情..但它会工作的。

于 2013-07-08T23:17:14.767 回答