$.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' })