• jsonp请求返回前面带有个null


     正确写法:

    $.ajax({
    type: "get",
    url: '<%=APP_URL_ZZGRID%>/zzgl/map/data/situation/getPlayRtspJsonp.json',
    dataType: "jsonp",
    jsonp: "jsoncallback",
    data: {
    monitorId: monitorId
    },
    success: function (data) {
    if (data.rtspUrl != '' && data.rtspUrl != undefined ) {
    var rtsp = data.rtspUrl.replace(/?/g, '%3F').replace(/&/g, '%26').replace(/=/g, '%3D');
    var url="<%=skyDomain%>/shequ/video/index.jhtml?streamAddr="+rtsp;
    $('#monitor_1').html('<iframe src="'+url+'" allowfullscreen="true" allowtransparency="true" webkitallowfullscreen="true" width="100%" height="100%" scrolling="no"></iframe>');
    } else {
    $.messager.alert('错误','获取播放链接失败!','error');
    }
    },
    error:function(data){
    $.messager.alert('错误','获取rtsp异常!','error');
    }
    错误写法:
    $.ajax({
    type: "POST",
    url: '<%=APP_URL_ZZGRID%>/zzgl/map/data/situation/getPlayRtspJsonp.json',
    dataType: "jsonp",
    data: {
    monitorId: monitorId
    },
    success: function (data) {
    if (data.rtspUrl != '' && data.rtspUrl != undefined ) {
    var rtsp = data.rtspUrl.replace(/?/g, '%3F').replace(/&/g, '%26').replace(/=/g, '%3D');
    var url="<%=skyDomain%>/shequ/video/index.jhtml?streamAddr="+rtsp;
    $('#monitor_1').html('<iframe src="'+url+'" allowfullscreen="true" allowtransparency="true" webkitallowfullscreen="true" width="100%" height="100%" scrolling="no"></iframe>');
    } else {
    $.messager.alert('错误','获取播放链接失败!','error');
    }
    },
    error:function(data){
    $.messager.alert('错误','获取rtsp异常!','error');
    }
    });
    原因:接口带有




    });
  • 相关阅读:
    HTML <a> 标签的 target 属性
    CSS display 属性
    test
    ubuntu开启ssh服务
    Ubuntu各个版本的介绍
    Ubuntu和RedHat的区别
    黑苹果Mac系统快捷键修改
    安装Ubuntu 8.04 Server
    VirtualBox虚拟机网络设置(转)
    修改eclipse的背景色(转载)
  • 原文地址:https://www.cnblogs.com/xyyou/p/14672640.html
Copyright © 2020-2023  润新知