Ajax requests return data, processing in templates

Source: Internet
Author: User

/*AJAX requests return data, processing in templates*/functionQuerygameasset () {varnew_start_time=$ (' #new_start_time '). Val ();//Start Time    varnew_end_time=$ (' #new_end_time '). Val ();//End Time    if(!new_start_time| |!new_end_time) {Alert ("Time cannot be empty"); return false; } $.ajax ({URL:'/statisticsgame/settlementstatisticscount ', data:{//req_date:$ (' #datetimepicker1 '). Val (),New_start_time:new_start_time,//Start TimeNew_end_time:new_end_time,//End Timereq_game:$ ("#select_game1"). Select (). val (), get_select_platform:$ (' #select_platform '). Val (), Req_mode:search_mode}, type:' Post ', Cache:false, Async:true, DataType:' JSON ', Success:function(data) {if(data["req"]! = "Success") {Coverit (); }Else{Hidden_coverit (); }            $(". Asset_table_tr"). Remove (); if(data["req"] = = "Success"){                varTotal_bet = 0; varTotal_charge=0; varTotal_revenue=0; varTotal_prizes=0;  for(i = 0; i < data["Data"].length; ++i) {//For loop traversal data output                    varBet=number (data["Data"][i][' Total_bet ');//total flow of players                    varCharge=number (data["Data"][i][' total_tips ');//Total player Net loss                    varRevenue=number (data["Data"][i][' revenue ');//Jackpot Purchase Amount                    varPrizes=number (data["Data"][i][' prizes ');//Jackpot Winning Amount                    varDate = data["Data"][i]["_id"];//Date                    varSelect_platform_name = data["Data"][i]["Select_platform_name"];//Platform Name                    varText = ' <tr class= ' asset_table_tr ' ><td> ' +date + ' </td> '; Total_bet+=bet; Total_charge+=charge; Total_revenue+=revenue; Total_prizes+=Prizes; Text+ = ' <td> ' + select_platform_name + ' </td> '; Text+ = ' <td> ' + bet + ' </td> '; Text+ = ' <td> ' + bet + ' </td> '; Text+ = ' <td> ' + revenue + ' </td> '; Text+ = ' <td> ' + prizes + ' </td> '; Text+ = ' </tr> '; $("#asset_table"). append (text); }                /*Append data display After the end of the template data traversal*/                varText1; varStr= ' Total '; varStr2= ' \ '; Text1+ = ' <tr> '; Text1+ = ' <td> ' + str + ' </td> '; Text1+ = ' <td> ' + str2 + ' </td> '; Text1+ = ' <td> ' + Total_bet + ' </td> '; Text1+ = ' <td> ' + total_charge + ' </td> '; Text1+ = ' <td> ' + total_revenue + ' </td> '; Text1+ = ' <td> ' + total_prizes + ' </td> '; Text1+ = ' </tr> '; $("#asset_table"). Append (Text1); }Else{                varerror_message=data[' Error_message '];                alert (error_message); return false; }}, Error:function() {        }    });}

Ajax requests return data, processing in templates

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.