前言:
成功等于目标,其他都是这句话的注解
--------------------------------正文---------------------------------
js代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script>
function abc(json){
alert(json.s);
}
</script>
<script src="https://sp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su?wd=a&cb=abc"></script>
</head>
<body>
</body>
</html>
jQuery代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="js/jquery-1.9.1.min.js"></script>
</head>
<body>
<script>
$(document).ready(function(){
$.ajax({
url:'https://sp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su',
data:{
wd: 'a'
},
dataType: 'jsonp',
jsonp: 'cb' // cb 是回调函数
}).then(function(res){
alert(res.s);
},function(){
alert('!ok')
});
});
</script>
</body>
</html>
网友评论