通过ajax得到数据,显示http://localhost:8081/项目名/[object%20Object] 404 (Not Found) 错误。

今天在使用easyui-datagrid 中的toolbar,通过ajax得到数据时,出现http://localhost:8080/项目名/[object%20Object] 404 (Not Found) 错误。

toolbar: [{
               id: 'btnAdd',
               text: '添加',
               iconCls: 'icon-add',
               handler: function () {
                   $.get({
                       url:"/rz/MyServlet?method=fun",
                       });
};
}]

折腾了一个小时,不论是get还是post方法都尝试了,还是不行,最后将get|post修改成ajax,并添加type属性,就正常了。

toolbar: [{
               id: 'btnAdd',
               text: '添加',
               iconCls: 'icon-add',
               handler: function () {
                   $.ajax({
type:”get”,
                        url:"/rz/MyServlet?method=fun",
                       });
};
}]

有人说,出现标题中的问题的原因是jquery包版本太低。
  解决方法:
  1、将 .post使 .ajax;
  2、使用较高的jquery包版本。

你可能感兴趣的:(aiax)