Jsoncallback ({" info ": [
{" url ":" http://127.0.0.1/xwzx/01/327263.shtml ", "title" : "the recent weather situation analysis", "summary" : "in the next few days, most of the temperature in our province general trend is to enter on the resilience of the channel, while the degree of cold abated, but now, after all, in a bitter winter"},
{" url ":" http://127.0.01/xwzx/01/327224.shtml ", "title" : "the recent weather situation analysis", "summary" : "1 PM: the provincial fine sometimes cloudy,"},
]})
HTMl file name index. HTM, release for the machine http://127.0.0.1 code is:
<script SRC="https://bbs.csdn.net/topics/js/jquery-1.9.1.js" & gt; </script>
$. Ajax ({
Url: 'http://127.0.0.1/tqxs_order.htm',
DataType: "json",
Success: the function (data) {
Var infoNum=1;
$. Each (data, function (I, json) {
If (infoNum> 6) return false.
$(" # TQXS "). Append (" & lt; Li> " );
InfoNum++;
})
},
Error: function () {
return true;
}
});
})
</script>
The question now is whether the page is not an error and no data,
CodePudding user response:
$. Ajax ({
Url: 'http://127.0.0.1/tqxs_order.htm',
DataType: "json",
Json: "jsoncallback,"
Jsoncallback jsonpCallback: ", "
Success: the function (data) {
Var infoNum=1;
$. Each (data info, function (I, json) {
If (infoNum> 6) return false.
$(" # TQXS "). Append (" & lt; Li> " );
InfoNum++;
})
},
Error: function () {
return true;
}
});
})
</script>