jsonp请求返回前面带有个null

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‘);
}
});
原因:接口带有

jsonp请求返回前面带有个null

 

 




});

jsonp请求返回前面带有个null

上一篇:.NET HttpWebRequest(请求被中止: 未能创建 SSL/TLS 安全通道)和(基础连接已经关闭: 发送时发生错误)问题查找解决


下一篇:还有必要学习OpenGL吗(还是直接学Metal)