这是因为没有正确呈现的链接以 / 最后你得到了 <a href=link/> 和 /> 被jquery解释为 <a> 标记,所以它基本上重写为 <a href=link></a> 是的。为了避免这种行为,你需要在引用之间建立联系。
/
<a href=link/>
/>
<a>
<a href=link></a>
尝试将代码更改为:
$.ajax({ url: "/follow", type: 'post', data: $(form).serialize(), success: function (res) { console.log('followed successfully', res) }, error: console.log('an error occured') });