callback function doesn't work when using getJSON function in jQuery

后端 未结 8 1948
心在旅途
心在旅途 2021-01-01 15:59

I am trying to use the getJSON function in jQuery to import some data and trigger a callback function. The callback function doesn\'t run. However, if I try the same thing w

8条回答
  •  Happy的楠姐
    2021-01-01 17:02

    Use $.post instead of $.getJSON(), in MVC2 if you are using $.getJSON or $.get be sure to set JsonRequestBehavior to AllowGet. Else this will return HTML error that causes your requst not to trigger the callback.

提交回复
热议问题