weixin_33691598 2014-11-04 08:30 采纳率: 0%
浏览 155

JSONP-未调用回调

I created a jsonp ajax call for getting data via cross domain. The thing right now is - I successfully manipulated it to send data over a webserver.

But it fails receiving data in a get call. When I have look in the debugger I see that the network tab receives the file and within there is the data. But I still get an error message.

The url gets a parameter with the jquery callback key. My webservices uses that key and adds it again in the response header. (which I also see in the debugger). I also receive a OK 200 status code in the network tab that the data is received...

The question now is why the ajax call doesn't jump into the success function but shows me everytime the error that the callback isn't called.

What do I do wrong?

The code looks like this:

    $.ajax({
        url: getServicePath,
        dataType: 'jsonp',  
        username: "abc",
        password: "123",
        contentType: "application/json",
        success: function(results) {
                 alert(results);
        },
        error: function(XMLHttpRequest, textStatus, errorThrown) { 
                 alert("Status: " + textStatus); alert("Error: " + errorThrown); 
        }   

Thanks for your help!! :)

  • 写回答

1条回答 默认 最新

  • weixin_33671935 2014-11-04 09:22
    关注

    I solved the problem.

    The webservice is an SAP ABAP webservice. The problem was that I didn't include the following line of code to support jsonp correctly.

    CONCATENATE _callback '(' _json_string ')' INTO _json_string.

    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分