extra.js 1.09 KB
   
    function extraAction ($array)
    {  
        $.ajax({
            type: 'GET',
            url: '/ajax/extra.php',
            dataType: 'json', 
            data: $.param ($array['json']),
            success: function (response)
            {
                switch ($array['json']['jaction']) 
                { 
                    case 'extra': 
                    	 
                    	modalBoxLoad (response.html, {
                    		autoClose: 800, 
                    	}); 
                		break;
                }
            },
            error: function()
            {
            	modalBoxLoad ('×òî-òî ïîøëî íå òàê...');
            }  
        });
        
    }

$(function() 
{
    $(".switch").bootstrapSwitch(
    {    
        onSwitchChange: function(event, state) 
        { 
            extraAction ({
                'json': {
                    'jaction': 'extra',
                    'status_id': state === false ? 0 : 1,
                    'extra_id': $(this).closest('.line').attr('id').replace('extra-', ''),
                }
            });  
        }
    });
});