a minimal change to my code is breaking it

Posted by Delirium tremens on Stack Overflow See other posts from Stack Overflow or by Delirium tremens
Published on 2010-03-24T10:59:09Z Indexed on 2010/03/24 11:03 UTC
Read the original article Hit count: 190

Filed under:
|
|

Works (it sets lasturi):

var domainnameuri;
var generaldomainnameuri;
domainnameuri = sc.domainnameuri;
generaldomainnameuri = sc.generaldomainnameuri;

sc.redirectinggeneral = false;
$.ajax({
    type: "GET",
    url: generaldomainnameuri,
    success: function(data, textStatus) {
        if (data.redirect == domainnameuri) {
            sc.redirectinggeneral = true;
        }
        sc.setlasturi();
    }
});

Doesn't work (it doesn't set lasturi):

this.setredirectinggeneral = function(c) {
    var domainnameuri;
    var generaldomainnameuri;
    domainnameuri = sc.domainnameuri;
    generaldomainnameuri = sc.generaldomainnameuri;

    sc.redirectinggeneral = false;
    $.ajax({
        type: "GET",
        url: generaldomainnameuri,
        success: function(data, textStatus) {
            if (data.redirect == domainnameuri) {
                sc.redirectinggeneral = true;
            }
            c();
        }
    });
}
sc.setredirectinggeneral(sc.setlasturi);

Why?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery