想要提交:https://sug.so.360.cn/suggest/word?word=哈哈
但提交的是 https://sug.so.360.cn/suggest?&callback=jQuery11240037762399888506604_1596078142975&word=哈哈&_=1596078142979
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="../js/jquery-1.12.4.min.js"></script>
<script>
$(function name(params) {
$("#txt").blur(function name(params) {
var $val=$(this).val();
$.ajax({
url: " https://sug.so.360.cn/suggest/word?",
type: "get",
dataType: "jsonp",
// data 设置发送给服务器的数据
data:{"word":$val},
})
.done(function name(data) {
// alert(data)
// 清空元素里面的内容
$('#list01').empty();
var dat = data.s;
for (var i = 0; i < dat.length; i++) {
var $newli = $('<li>');
$newli.html(dat[i]);
$newli.appendTo($('#list01'));
}
})
.fail(function name(data) {
alert("服务器超时")
})
})
})
</script>
</head>
<body>
<!-- https://sug.so.360.cn/suggest/word?callback=suggest_so&format=json&encodein=utf-8&encodeout=utf-8&word=哈哈方&_jsonp=suggest_so -->
<input type="text" name="" id="txt" placeholder="请要联想的输入">
<ul class="list01"></ul>
</body>
</html>