can3p (can3p) wrote in changelog,
can3p
can3p
changelog

[livejournal] r18120: LJSUP-7793: The preloader doesn't stop

Committer: dpetrov
LJSUP-7793: The preloader doesn't stop
U   trunk/htdocs/js/widgets/potd.js
Modified: trunk/htdocs/js/widgets/potd.js
===================================================================
--- trunk/htdocs/js/widgets/potd.js	2011-01-26 11:41:51 UTC (rev 18119)
+++ trunk/htdocs/js/widgets/potd.js	2011-01-27 04:57:45 UTC (rev 18120)
@@ -81,13 +81,23 @@
 			timer_reached = true;
 			checkStatus();
 		}, 1000);
-		jQuery.post(form.attr('action'), form.serialize() + '&poll-submit=submit', function() {
+
+		function formSent() {
 			var skip = form.prev('input[name="skip"]').val();
 			PotD.cache[skip] = null;
 			PotD.getQuestion(form, skip);
 			response_received = true;
 			checkStatus();
-		});
+		}
+
+		jQuery.ajax( {
+			url: form.attr( 'action' ),
+			data: form.serialize() + '&poll-submit=submit',
+			type: "POST",
+			success: formSent,
+			//server returns 302 status and in this case xhr.status === 0, => error. We handle this
+			error: formSent
+		} );
 		return false;
 	});
 });

Tags: can3p, js, livejournal
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments