<script type="text/javascript">
$(function() {
function fun1(data1) {
console.log(data1.list);
}
function fun2(data1) {
console.log(data1.list);
}
function fun3(data1) {
console.log("fun3 called upon faliure");
}
var successFunctions = [fun1, fun2];
var failureFunctions = [fun3];
$.when(
$.ajax("http://localhost/PhpProject1/index.php", {
jsonpCallback: 'yes',
contentType: "application/json",
dataType: 'jsonp'
})
).then(successFunctions, failureFunctions);
});
</script>
我尝试上面的代码来检索数据并在使用Jquery defferd获取数据后触发一些函数(如果我是正确的)。但是这段代码甚至没有给我任何错误