今天写程序时  出现了下面问题:

前台

$.post('ajax/GetDataAjax.ashx', { 'mode': 'DEL', 'BM_ID': bm_id }, function (result)
{
  alert(result);

}, 'json');

后台

public void DeleteData(HttpContext context)
{
//获取到要删除的信息
  string BM_ID = context.Request["BM_ID"];
  bll.Delete(BM_ID);
  context.Response.Write("1");
  context.Response.End();
}

 

发现 返回数字的时候,执行alert,如果是返回字符串,则不执行alert,post 和 get  的 都不行,ajax 不管返回什么都可以。

如果把json去掉的话,则不管返回什么都执行 该方法

相关文章:

  • 2021-12-01
  • 2021-08-15
  • 2021-12-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-29
猜你喜欢
  • 2022-12-23
  • 2021-05-31
  • 2021-04-02
  • 2021-05-25
  • 2021-06-29
  • 2021-06-21
  • 2021-09-12
相关资源
相似解决方案