5 に答える 5

4

これで始められるはずです:

$(document).on('click', 'a', function(event) {
  event.preventDefault();    // Now the link doesn't do anything
  var href = this.href;      // The link's URL is in this variable
});
于 2012-04-13T23:09:44.497 に答える
1

次のようなことができます

$(document).on('click', '*[href]', function(e) {
   // Whatever you're trying to do
   e.preventDefault();
   return false;
});
于 2012-04-13T23:10:12.190 に答える
0
<a href="javascript:void(0);">...</a>

その後、このアンカーのスクリプトを作成できます。

于 2012-04-13T23:12:25.990 に答える
0

これはそれを行う必要があります:

$("a").click(function(event) {
  event.preventDefault();
  var href = $(this).attr("href");
  $.ajax({
     url: href,
     success: function(data) {
      alert('Load was performed.');
    }
  });
});
于 2012-04-13T23:14:46.267 に答える
0
$(document).on('click','a[href]',function(){
    var href = $(this).attr('href');

    $.ajax(href,function(data){
        $(your_container).html(data);
        //data is the HTML returned
        //note that ajax is bound to the
        //same origin policy
        //any request outside your domain won't work
    })

    return false;
});
于 2012-04-13T23:10:57.690 に答える