Cake PHP div刷新服务器崩溃了

时间:2016-06-17 13:17:44

标签: ajax cakephp crash server

我正在使用cake php

8次我使用了服务器的div刷新模式,但几分钟后我的服务器崩溃,我不得不要求服务器提供商重新打开服务器。

如果我想通过div refresh使用数据库,最好的方法是什么?

function check()
{
    $.ajax({
        type : 'POST',
        url : '<?php echo $this->webroot;?>'+'Bookings/rand_f',
        dataType : 'html',
        data: {},
        cache : false,
        success:function(result){
            $('#ht').html(result);
            $("#session_value").val(result);
    }});
}
setInterval(check, 1000);

function check_count()
{
    var a=$("#session_value").val();
    $.ajax({
        type : 'POST',
        url : '<?php echo $this->webroot;?>'+'Bookings/check_count/'+a,
        dataType : 'html',
        data: {},
        cache : false,
        success:function(result){
            if(result=='change'){
                $('#res').val(result);
                listings_live1();
            }else{
                $('#res').val('no_change');
            }
    }});    
}
setInterval(check_count, 1000);

function listings_live1()
{
    var a=$("#session_value").val();
    $.ajax({
        type : 'POST',
        url : '<?php echo $this->webroot;?>'+'Bookings/listingsbookingcheck/'+a,
        dataType : 'html',
        data: {},
        cache : false,
        success:function(result){
            var x=  $('#live_listing').html(result);
            if(x){
                return 1;
            }
    }});
}

function check_count_all()
{
    var x=$("#last_count_all").val();
    $.ajax({
        type : 'POST',
        url : '<?php echo $this->webroot;?>'+'Bookings/check_count_all',
        dataType : 'html',
        data: {},
        cache : false,
        success:function(result){
            $("#count_all").val(result);
            if(result!=x){
                listings_liveall();
                $("#last_count_all").val(result);
                $("#st").val('change');
            }
            else{
                $("#st").val('nochange');
            }
    }});
}
setInterval(check_count_all, 1000);

function listings_liveall()
{ 
    $.ajax({
        type : 'POST',
        url : '<?php echo $this->webroot;?>'+'Bookings/listingall',
        dataType : 'html',
        data: {},
        cache : false,
        success:function(result){
            $('#listings_liveall').html(result);
    }});
}

function showaction(str,id){
    $("#boking_status_call_cancel").show();
    $("#alertshow").html('Are you sure you want to '+str+' this Booking?');
    if(str!='accept'){
        $("#reject_reason").show();
    }else{
        $("#reject_reason").hide();
    }
    $("#role_call").val(str+','+id);
}

function update_mobile_booking(){
    var strcall=$("#role_call").val();
    $.ajax({
        type : 'POST',
        url : '<?php echo $this->webroot;?>'+'Bookings/update_booking_mobile/'+strcall,
        dataType : 'html',
        data: {},
        cache : false,
        success:function(result){
            var x=listings_live1();
            if(x==1){
                listings_liveall();
            }
    }});
}

/*settimeout page load mobile booking*/
var myFunc = function() {
    listings_live1();
    listings_liveall();
}
window.onload = function() {
    setTimeout(myFunc, 1000);
}
/*
function check_counter_upper(){
    c1=$("#session_value").val();
    c2=$("#count_chk_cl").val();
    if(c1!=c2 && c2!='undefined'){
        listings_live1();
        $("#st1").val('force_change');
    }else{
        $("#st1").val('no_force_change');
    }
}

setInterval(check_counter_upper, 4000);*/

0 个答案:

没有答案
相关问题