weixin_33695082 2009-06-22 11:31 采纳率: 0%
浏览 48

Firefox Ajax jQuery调用错误

I am developing an application but I am having problems to get it to work in Firefox. The application recieves javascript calls from educational applications (websites that are showed in shared window) and it is supposed to return values from a .net webservice. The values must be returned in the same function that recieves the call. The webservices return values are strings that can be true,false or sometimes a value from a database. The websevice supports ajax.

Since I dont know exactly how to call a webservice using javascript I am using jquery-1.3.2.

The code bellow works on Internet Explorer but when used on Firefox it is like it wont wait for the call to return a value despite the async:fale.

function API_LMSInitialize(param)
{
  res="true";
  $.ajax({
    type: "POST",
    contentType: "application/json; charset=utf-8",
    url: "../../../GateWay/WebService.asmx/LMSInitialize",
    data: "{'courseid':'"+courseid+"','userid':'"+userid+"'}",
    dataType: "json",
    async: false,
    success: function(msg) { res = msg; },
    error: function(){ res="false"; }
  });

  return res;
}

Any suggestions?

  • 写回答

4条回答 默认 最新

  • weixin_33701251 2009-06-22 11:51
    关注

    Probably the ajax call fails and exits through the error callback. You can add an alert to verify this or even better use Firebug and console.log.

    The reason that the call succeeds with IE and fails with Firefox could have to do with the JSON data returned. Are you sure that Firefox can parse this data correctly? Firebug can also help with this.

    Finally it isn't good practice to use synchronous mode. It will be better to modify your code to work asynchronously.

    评论

报告相同问题?

悬赏问题

  • ¥20 蓝牙耳机怎么查看日志
  • ¥15 Fluent齿轮搅油
  • ¥15 八爪鱼爬数据为什么自己停了
  • ¥15 交替优化波束形成和ris反射角使保密速率最大化
  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏