app.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. $(function(){
  2. $('.form-ajax').submit(function(e){
  3. e.preventDefault();
  4. $.ajax({
  5. url : $(this).attr('action'),
  6. type : 'POST',
  7. dataType : 'json',
  8. data: $(this).serialize(),
  9. beforeSend: function(){
  10. $('.prompt-error').text('');
  11. $('.woody-prompt').hide();
  12. },
  13. success : function(result){
  14. if(result.status=='0'){
  15. $('.prompt-error').html('<span class="glyphicon glyphicon-info-sign"></span>&nbsp;'+result.msg);
  16. $('.woody-prompt').show();
  17. }
  18. if(result.status=='1'){
  19. alert(result.msg);
  20. if(result.url){
  21. window.location.href = result.url;
  22. }
  23. }
  24. if(result.status=='0'){
  25. $('[name=chkcode]').val('');
  26. $('.imgcode').click();
  27. }
  28. }
  29. });
  30. });
  31. $(window).scroll(function(){
  32. $('.top-notice').hide();
  33. if($(this).scrollTop()==0){
  34. $('.top-notice').fadeIn();
  35. }
  36. });
  37. });