What is the application of ajax's json value transfer method in jsp pages?
This article is to share with you about the application of ajax json value transfer in jsp pages, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article. Let's take a look at it with the editor.
Jsp page:
The code is as follows:
$(document) .ready (function () {
SetInterval (function myTimer ()
{
/ / alert ('a')
GetViews ()
}, 1000)
});
/ / play
Function getViews () {
$.ajax ({
'url': "${pageContext.request.contextPath} / video/getVideos.action?r=" + Math.random () + "& open=1"
'data':''
'dataType': 'json'
'type': 'get'
'error': function (data) {
Alert ("error")
Return false
}
'success': function (data) {
If (null! = data & &'! = data) {
/ / alert (data.updateFlag)
If (data.updateFlag==0) {/ / if data.updateFlag=0 does not refresh
/ / alert ("data.updateFlag=0")
}
Else {
If (data.videoIds! = null & & data.videoIds! = "") {
Var listIds=data.videoIds
Var iTunes 0
For (; I)