Don't bracket $.get with $.ajaxSetup

Instead, use the more general $.ajax which can take these options directly.

(imported from commit bb915e7d25cb6ac675d098903f7e7b57bde5006e)
This commit is contained in:
Keegan McAllister 2012-09-06 15:30:02 -04:00
parent 9e3f588276
commit 115334c82a
1 changed files with 18 additions and 17 deletions

View File

@ -67,25 +67,26 @@ $(function () {
return true;
}
var okay = true;
$.ajaxSetup({async:false}); // so we get blocking gets
$.get("subscriptions/exists/" + $("#class").val(), function(data) {
if (data == "False") {
// The class doesn't exist
okay = false;
send_status.removeClass(status_classes)
send_status.toggle();
$('#class-dne-name').text($("#class").val());
$('#class-dne').show();
$('#create-it').focus()
.click(function() {
sub($("#class").val());
$("#class-message form").ajaxSubmit();
$('#class-dne').stop(true).fadeOut(500);
});
buttons.removeAttr('disabled');
$.ajax({
url: "subscriptions/exists/" + $("#class").val(),
async: false,
success: function (data) {
if (data == "False") {
// The class doesn't exist
okay = false;
send_status.removeClass(status_classes)
send_status.toggle();
$('#class-dne-name').text($("#class").val());
$('#class-dne').show();
$('#create-it').focus().click(function() {
sub($("#class").val());
$("#class-message form").ajaxSubmit();
$('#class-dne').stop(true).fadeOut(500);
});
buttons.removeAttr('disabled');
}
}
});
$.ajaxSetup({async:true});
if (okay && class_list.indexOf($("#class").val()) == -1) {
// You're not subbed to the class
okay = false;