Click here to Skip to main content
15,906,708 members
Home / Discussions / JavaScript
   

JavaScript

 
GeneralRe: I am not sure why this controller is not firing in this AngularJS script, any help Pin
Karthik_Mahalingam22-May-16 0:39
professionalKarthik_Mahalingam22-May-16 0:39 
GeneralRe: I am not sure why this controller is not firing in this AngularJS script, any help Pin
indian14322-May-16 0:49
indian14322-May-16 0:49 
GeneralRe: I am not sure why this controller is not firing in this AngularJS script, any help Pin
indian14322-May-16 0:46
indian14322-May-16 0:46 
GeneralRe: I am not sure why this controller is not firing in this AngularJS script, any help Pin
Karthik_Mahalingam22-May-16 0:51
professionalKarthik_Mahalingam22-May-16 0:51 
GeneralRe: I am not sure why this controller is not firing in this AngularJS script, any help Pin
indian14322-May-16 1:13
indian14322-May-16 1:13 
GeneralRe: I am not sure why this controller is not firing in this AngularJS script, any help Pin
Karthik_Mahalingam22-May-16 1:16
professionalKarthik_Mahalingam22-May-16 1:16 
QuestionUsing JQuery $.when, addng a promise to each function so When knows its done. Pin
jkirkerx5-May-16 12:12
professionaljkirkerx5-May-16 12:12 
AnswerI think I might have it now, not sure if its the right way to do it, but it works. Pin
jkirkerx5-May-16 13:38
professionaljkirkerx5-May-16 13:38 
OK, that was difficult to understand. But is needed so teh form doesn't fail on the user.
Any comments, would you do it different?
$uContainer.empty().html(uElements).show().promise().done(function (arg1) {
    var promise_cardBrands = select_cardBrands('CreditDebitRecord_Update_Card_Brand');        
    promise_cardBrands.done(function () {
        select_expMonths('CreditDebitRecord_Update_Card_ExpMonth');
        select_expYears('CreditDebitRecord_Update_Card_ExpYear');
        var promise_Countries = load_updateCard_countryCodes();
        promise_Countries.done(function () {
            var promise_States = load_updateCard_stateCodes("US");
            promise_States.done(function () {
                var promise_Record = load_cardData_update_record(_paymentID);
            });
        });
    });        
    // Rebind the Change Country Code
    $("#CreditDebitRecord_Update_BillingAddress_CountryCode").change(function () {
        var _countryCode = $("#CreditDebitRecord_Update_BillingAddress_CountryCode option:selected").val();
        load_updateCard_stateCodes(_countryCode);
    });
    $("#CreditDebitRecord_Update_Card_Name").focus();
});

JavaScript
function load_updateCard_stateCodes(_countryCode) {

    var $e_StateCode                    = $("#CreditDebitRecord_Update_BillingAddress_StateCode"),
        procemessage                    = "<option value='0'> Please wait...</option>",
        deferred                        = new $.Deferred();

    if (_countryCode !== '--') {       
        $e_StateCode.html(procemessage).show();
        $.ajax({
            type: "POST",
            cache: true,
            dataType: "json",
            url: '/Ajax/load_StateCodes',
            data: { CountryCode: _countryCode },
            error: function (response) {
                debugger;
                alert("http " + response.status + " Error: load_stateCodes - data: " + response);
            },
            success: function (data) {

                var markup = "<option value='--'>Select State / Province</option>";
                for (var x = 0; x < data.length; x++) {
                    markup += "<option value=" + data[x].value + ">" + data[x].text + "</option>";
                }
                $e_StateCode.html(markup).show();
                deferred.resolve("finished");
            }
        });
    }
    return deferred.promise();
}

GeneralRe: I think I might have it now, not sure if its the right way to do it, but it works. Pin
Nathan Minier6-May-16 1:50
professionalNathan Minier6-May-16 1:50 
GeneralRe: I think I might have it now, not sure if its the right way to do it, but it works. Pin
jkirkerx6-May-16 5:27
professionaljkirkerx6-May-16 5:27 
GeneralRe: I think I might have it now, not sure if its the right way to do it, but it works. Pin
Nathan Minier6-May-16 6:14
professionalNathan Minier6-May-16 6:14 
GeneralRe: I think I might have it now, not sure if its the right way to do it, but it works. Pin
jkirkerx6-May-16 7:28
professionaljkirkerx6-May-16 7:28 
QuestionNeed an API similar to YouTube Help popup window Pin
Zaki Gaima5-May-16 3:28
Zaki Gaima5-May-16 3:28 
Questionbrowser error handling using javascript Pin
rorschach2174-May-16 19:25
rorschach2174-May-16 19:25 
SuggestionRe: browser error handling using javascript Pin
Richard MacCutchan4-May-16 20:58
mveRichard MacCutchan4-May-16 20:58 
AnswerRe: browser error handling using javascript Pin
John C Rayan13-May-16 1:18
professionalJohn C Rayan13-May-16 1:18 
QuestionAsynchronouse Call Pin
Syed Rehman27-Apr-16 9:14
Syed Rehman27-Apr-16 9:14 
QuestionRe: Asynchronouse Call Pin
ZurdoDev27-Apr-16 9:29
professionalZurdoDev27-Apr-16 9:29 
AnswerRe: Asynchronouse Call Pin
John C Rayan4-May-16 22:20
professionalJohn C Rayan4-May-16 22:20 
Questionhelp me writing a small program Pin
Member 1248677626-Apr-16 10:36
Member 1248677626-Apr-16 10:36 
AnswerRe: help me writing a small program Pin
Afzaal Ahmad Zeeshan26-Apr-16 11:00
professionalAfzaal Ahmad Zeeshan26-Apr-16 11:00 
AnswerRe: help me writing a small program Pin
Peter_in_278026-Apr-16 21:05
professionalPeter_in_278026-Apr-16 21:05 
GeneralRe: help me writing a small program Pin
Karthik_Mahalingam5-May-16 23:27
professionalKarthik_Mahalingam5-May-16 23:27 
QuestionHelp me to write a small program. Pin
Member 1248677626-Apr-16 10:21
Member 1248677626-Apr-16 10:21 
AnswerRe: Help me to write a small program. Pin
Member 1161095626-Apr-16 10:53
Member 1161095626-Apr-16 10:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.