Bug with combination of: jQuery 1.4, ajax/json, Firebug Lite and IE 8

我们两清 提交于 2019-12-03 07:43:51

I've actually seen the same problem with plain HTML responses, too.

I can't at the moment get the webservice to output the correct contentType, but I have been able to use $.ajax() in the latest version of jQuery by modifying my javascript code as follows...

$.ajax({
 cache: false,
 url:"http://localhost:8080/Performance_Reporting/TestServlet",
 type:"GET",
 contentType: "application/json",
 dataType: "text",
 timeout:30000,
 success: function(d, status, req)
 {
  $("#result").text($.parseJSON(d).x);
 },
 error: function(req, status, err)
 {
  $("#result").text(req.responseText);
 }
})

The difference is make the service expect TEXT not JSON, and then parse the JSON....

d = $.parseJSON(d);

Bodge, but fixed.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!