gpt4 book ai didi

jquery - 当 jquery post 未触发 asp.net mvc Controller 操作时,调试的最佳方法是什么

转载 作者:行者123 更新时间:2023-12-01 07:35:17 24 4
gpt4 key购买 nike

我在 Controller 操作上放置了一个断点,但它从未触发。有没有办法捕获 jquery post 上的错误?

这是我的 jquery javascript 代码:

  <script type="text/javascript">
$(document).ready(function() {

$('#commitExerciseButton').live('click', function() {

$.post($("#exerciseForm").attr('action'), $("#exerciseForm").serialize(), function(data) {

$("#exercise").html("<h1>Exercise Added</h1>");
$("#tabs-2").html(data);

});
return false;
});
});
</script>

编辑:

我解决了这个问题..我必须这样做:

$("#exerciseForm Form").serialize() 而不是 $("#exerciseForm").serialize()

最佳答案

如果你可以使用 $.ajax 代替,你可以定义一个错误回调并查看返回的内容,还有像 firebug for firefox 这样的工具对于查看正在发布的内容非常有用,这里有一个link显示ajax调用和错误回调

关于jquery - 当 jquery post 未触发 asp.net mvc Controller 操作时,调试的最佳方法是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2575107/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com