Created
December 28, 2012 23:54
-
-
Save mythmon/4403260 to your computer and use it in GitHub Desktop.
This only prints "-1", and then "It works.". Then nothing else.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajax({ | |
type: 'POST', | |
url: $form.prop('action'), | |
data: $form.serialize(), | |
dataType: 'json', | |
success: function(data) { | |
console.log('-1'); | |
console.log('It worked.'); | |
console.log('0'); | |
$form.find('textarea').value(''); | |
console.log('1'); | |
var $firstBubble = $('.status-block .bubble').first(); | |
console.log('2'); | |
var firstUser = $first_bubble.data('user'); | |
console.log('3'); | |
// Prepare a new status element. UGH UGH UGH. | |
var $status = $firstBubble.clone(); | |
console.log('4'); | |
$status.find('.update').html(data.content_html); | |
console.log('5'); | |
$status.find('.post-time').prop('href', '/status/' + data.id); | |
console.log('6'); | |
var $time = $status.find('time'); | |
console.log('7'); | |
$time.prop('datetime', data.created).html(''); | |
console.log('8'); | |
fixTimezones($time); | |
console.log('9'); | |
$status.find('.comment-count').html('0'); | |
console.log('10'); | |
$status.find('.project-name').html(data.project.name); | |
console.log('11'); | |
if (data.project.color) { | |
var c = data.project.color; | |
$status.find('.project-name').css({ | |
'background-color': '#' + c, | |
color: '#' + c | |
}); | |
} | |
console.log('12'); | |
if (data.user.slug == firstUser) { | |
// Sweet. | |
console.log('Same user'); | |
$firstBubble.prepend($status); | |
} else { | |
console.log('Different user'); | |
$firstBubble.clone().prependTo($firstBubble.parent()); | |
} | |
console.log('ok, all done'); | |
}, | |
error: function(err) { | |
console.log('uh oh'); | |
console.log(err.responseText); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment