开发者

why ajax call url ends with #.?

$.ajax({
    type:'GET',
    cache: 'false',
    url:"/foo/",
    data:{"id": pid},
    success:function(data) {
         开发者_StackOverflow社区$('#wrapper').html(data);
    }
});

<li id="btn-click" class="select">{{ promo.name }}</li>

Why ajax url ends with #. Suppose My url is http://localhost:8000/foo/ then it ends with http://localhost:8000/foo/#. I don't want to use #. at the last.


Does your anchor have a # in it so that it doesn't reload the page? If so, on your click event you will need to either return: false; or use event.stopPropagation(); to prevent the default behaviour.

What is the value of {{ promo.name }} ??


Maybe you have href="#" on the link that runs the ajax call? use href="javascript:void(0)" instead.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜