Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- $('#PP_Post').on('submit', function(e) {
- var $btn = $(this).find('.Submit');
- $btn.attr('disabled', true);
- $btn.val('Posting...');
- e.preventDefault();
- $.ajax({
- type: 'POST',
- data: $('#PP_Post').serialize(),
- url: $(this).attr('action'),
- success: function(msg) {
- var targetOffset = $('#Profile_Posts').offset().top;
- // Insert post
- $(msg).insertBefore('#Profile_Posts .most_recent');
- // Scroll to top of posts
- $("body, html").animate({scrollTop: targetOffset}, 600);
- // Re-enable submit button
- $btn.removeAttr('disabled');
- // Update button text
- $btn.val('POST');
- // Clear old post message
- $('#PP_Post .descriptionField').val('');
- }
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement