一:java后台
public void getNotices() {
String callback = getPara(\"callback\");
List<Record> notices = NoticeService.me.getNotices();
if (null == callback || callback.trim().equals(\"\")) {
renderJson(notices);
} else {
renderJson(callback + \"(\" + notices + \")\");
}
}
二:页面ajax
function a() {
$.ajax({
url : \"http://hjsgzh.xxx.com/notice/getNotices\",
data : {
name : \'篮球\',
},
type : \"post\",
dataType : \"jsonp\",
jsonp : \"callback\",
async : false,
error : function(error) {
console.log(error);
},
success : function(res) {
console.log(res);
}
})
}
三:小结
jsonp的值就是后台获取的参数名字
继续阅读与本文标签相同的文章
-
flex布局和grid布局
2026-05-18栏目: 教程
-
语音顶会Interspeech 论文解读|Constrained output embeddings for end-to-end code-switching speech recognition with only monolingual data
2026-05-18栏目: 教程
-
《Android应用开发进阶》| 每日读本书
2026-05-18栏目: 教程
-
“阿里云十年,因为有我而不同”,征文活动开始了!
2026-05-18栏目: 教程
-
玩转 Drone CI
2026-05-18栏目: 教程
