Blogger Information
Blog 28
fans 1
comment 0
visits 17554
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
2019.5.22作业
关超的博客
Original
696 people have browsed it

$.get(), $.post(), $.ajax()小练习


$.get(
            'inc/detail.php',
            {key: $(event.target).val()},   
            function (data,status){     
                console.log(status);
                if (status === 'success') {
                    $('#detail').html(data);   
                    $('[value=""]').remove();  
                } else { 
                    $('#detail').html('<span style="color:red">请求错误</span>');
                }
            },
            'html'
        );
        $.post(
            'inc/check.php',    
            {
                email: email.val(),
                password: password.val()
            },
            function(data) {
                if (data.status === 1) {
                    $('button')     
                        .after('<span style="color: green"></span>')    
                        .next()     
                        .html(data.message) 
                        .fadeOut(2000);    
                } else {
                    $('button')
                        .after('<span style="color: red"></span>')
                        .next()
                        .html(data.message)
                        .fadeOut(2000);
                }
            },
            'json' 
        );
        
        
        $.ajax({
            type: 'POST',
            url: 'inc/check.php',
            data: {
                email: email.val(),
                password: password.val()
            },
            success: function(data) {
                if (data.status === 1) {
                    $('button')     
                        .after('<span style="color: green"></span>')   
                        .next()    
                        .html(data.message) 
                        .fadeOut(2000);    
                } else {
                    $('button')
                        .after('<span style="color: red"></span>')
                        .next()
                        .html(data.message)
                        .fadeOut(2000);
                }
            },
            dataType: 'json'
        })
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post