我现在有点困惑,如果我把这个 jquery 放在我的网页上,一切正常。
<script>
$.get("/Recipe/SearchResult/", function (response) {
$("#SearchResults").html(response);
});
</script>
但是,我试图让这个在按钮上运行。所以我把它放在这样的函数中:
<script>
function Search() {
$.get("/Recipe/SearchResult/", function (response) {
$("#SearchResults").html(response);
});
};
</script>
使用萤火虫,如果我在函数 Search{} { 上打断,当我点击按钮时,它会在该行打断。但是,如果我跨过去,它似乎不会运行 jquery。它只是转到下一行的函数末尾,没有任何反应。
编辑:这是有按钮的行:
<button onclick="Search" type="submit" class="btn btn-success"><i class="icon-search"></i> Search</button>
有没有人有任何想法?
谢谢。