This article mainly introduces jQuery + AJAX to achieve no-refreshing drop-down loading more relevant information. If you need more information, refer to the development of the Internet era, the web Front-end has been linked to background data, as a web Front-end, it is not just to cut the graph and write html. css interacts with simple js.
Js code
$ (Function () {var page = 1; var discount = $ ('# discount'); var innerHeight = window. innerHeight; var timer2 = null; $. ajax ({url: '/lightapp/marketing/verify/apply/list? Page = 1', type: 'get', ype: 'json', timeout: '000000', cache: 'false', success: function (data) {if (data. error_code = 0) {var arrText = []; for (var I = 0, t; t = data. list [I ++];) {arrText. push (''); ArrText. push (''+ t. title +''); if (t. coupon_type = 1) {arrText. push ('
Amount: ¥' + t. amount +'
');} Else {arrText. push ('Discount: '+ t. amount +'
');} ArrText. push ('User: Is the s account's primary account? Ah, 12' + t. user_name + ''+ 'verification time: '+ t. use_time +'
'); ArrText. push ('');} Discount.html (arrText. join ('');}; var ajax_getting = false; $ (window ). scroll (function () {clearTimeout (timer2); timer2 = setTimeout (function () {var scrollTop = $ (document. body ). scrollTop (); var scrollHeight = $ ('body '). height (); var returns wheight = innerHeight; var scrollWhole = Math. max (scrollHeight-scrollTop-Skip wheight); if (scrollWhole <100) {if (ajax_getting) {return false;} else {ajax_getting = true;} discount. append (''); $ ('Html, body '). scrollTop ($ (window ). height () + $ (document ). height (); page ++; $. ajax ({url: '/lightapp/marketing/verify/apply/list? Page = '+ page, type: 'get', ype: 'json', success: function (data) {if (data. error_code = 0) {var arrText = []; for (var I = 0, t; t = data. list [I ++];) {arrText. push (''); ArrText. push (''+ t. title +''); if (t. coupon_type = 1) {arrText. push ('
Amount: ¥' + t. amount +'
');} Else {arrText. push ('Discount: '+ t. amount +'
') ;}; ArrText. push ('User: account token 111111111 '+ t. user_name + ''+ 'verification time:' + t. use_time +'
'); ArrText. push ('');} Discount. append (arrText. join (''); $ (". load "). remove ();} else {$ (". load "). remove (); discount. append ('No more data.
'); $ (Window ). unbind ('scroll ') ;}; ajax_getting = false ;}}) ;}; $ (". load "). remove () ;}, 200) ;}; if (data. error_code = 156006) {response ('.coupon'0000.html ('An error occurred!
Cause: not logged on
')}; If (data. error_code = 156003) {response ('.coupon'0000.html ('An error occurred!
Cause: the permission is insufficient ~ Please add
')}; If (data. error_code = 156007) {response ('.coupon'0000.html ('An error occurred!
Cause: Service exception
')}; If (data. error_code = 511) {response ('.coupon'0000.html ('An error occurred!
Cause: the account has not activated the direct account number.
')}; If (data. error_code = 520) {response ('.coupon'0000.html ('No write-off record
') }}, Error: function (data) {}}) $ (window ). bind ("orientationchange", function () {detail ('.sliders'}.css ('left', $ (window ). width ()/2 + 'px ');})})
The above is all the content of this article. I hope you will like it.