Javascript 部分jQuery未执行

Javascript 部分jQuery未执行,javascript,jquery,Javascript,Jquery,我的问题如下: 当我测试这个时,标记为未执行的部分不会执行。 在该点之前的其余代码工作正常,但在该行之后什么也没有发生 我错过什么了吗?我正在用firebug运行Firefox,我可以看到VAR(已注册、groupcontracting和thirdparty)被定义为1或0。。但它们看不到“未执行”行下面的代码可见 $(document).ready(function () { $('#restofform').css('display', 'none'); $('#phar

我的问题如下:

当我测试这个时,标记为未执行的部分不会执行。 在该点之前的其余代码工作正常,但在该行之后什么也没有发生

我错过什么了吗?我正在用firebug运行Firefox,我可以看到VAR(已注册、groupcontracting和thirdparty)被定义为1或0。。但它们看不到“未执行”行下面的代码可见

$(document).ready(function () {


    $('#restofform').css('display', 'none');
    $('#pharmdata').css('display', 'none');
    $('#form_bottom').css('display', 'none');
    $('#nextsteps').css('display', 'none');
    $('#group_status_message').css('display', 'none');
    $("#Affiliation").css('display', 'none');
    $("#affiliation_note").css('display', 'none');
    $("#AffiliationLabel").css('display', 'none');
    $("#affilitation").css('display', 'none');

    var enrolled;
    var groupcontracting;
    var thirdparty;

    $('#UserNumber').keyup(function check_enrollment() {

        //get the userid
        var userid = $('#UserNumber').val();
        var input_length = $("#UserNumber").val().length;

        function populate(frm, data) {
            $.each(data, function (key, value) {
                $('[id=' + key + ']', frm).val(value);
            });
        }

        if (input_length >= 7) {
            //network enrollment check
            var enlink = "enrollment_check.php?userid =" + userid;
            var gpclink = "group_contracting_check.php?userid =" + userid;
            var bncdlink = "thirdparty_check.php?userid =" + userid;
            $.getJSON(enlink, function (result) {
                console.log(result);

                if (jQuery.isEmptyObject(result)) {
                    //show that the pharmacy is not enrolled
                    $('#enroll_status').addClass('badge badge-inverse');
                    $('#enroll_status').html('Not Enrolled');
                    enrolled = '0';
                    console.log(enrolled);

                } else if (!jQuery.isEmptyObject(result)) {
                    //show that the pharmacy is enrolled
                    $('#enroll_status').addClass('badge badge-success');
                    $('#enroll_status').html('Enrolled');
                    enrolled = '1';
                    console.log(enrolled);
                }
            });
            // end of network enrollment check  

            // group contracting affiliation check
            $.getJSON(gpclink, function (gcresult) {
                console.log(gcresult);

                if (!jQuery.isEmptyObject(gcresult)) {
                    //show that the username is available
                    $('#group_status').addClass('badge badge-success');
                    $('#group_status').html('Group Affiliated');
                    groupcontracting = '1';
                    console.log(groupcontracting);

                } else if (jQuery.isEmptyObject(gcresult)) {
                    //show that the username is NOT available
                    groupcontracting = '0';
                    console.log(groupcontracting);
                }
            });
            // end of group contracting check

            // third party contractual relationship check
            $.getJSON(bncdlink, function (bdresult) {
                console.log(bdresult);

                if (!jQuery.isEmptyObject(bdresult)) {
                    //show that the username is available
                    $('#thirdparty_status').addClass('badge badge-success');
                    $('#thirdparty_status').html('Third Party');
                    thirdparty = '1';
                    console.log(thirdparty);

                } else if (jQuery.isEmptyObject(bdresult)) {
                    //show that the username is NOT available
                    thirdparty = '0';
                    console.log(thirdparty);
                }
            });
            //end of third party check


            // ***********THIS PART IS NOT BEING EXECUTED *************
            // check to see what the variables are set to and display accordingly

            if ((enrolled == '0') && (groupcontracting == '0') && (thirdparty == '0')) {

                // set hidden fields 
                $('input[name=enrolled]').val('0');
                $('input[name=groupcontracting]').val('0');
                $('input[name=thirdparty]').val('0');
                //show and hide appropriate parts of forms
                $('#restofform').css('display', '');
                $('#form_bottom').css('display', '');
                $('#pharmdata').css('display', 'none');
                $('#nextsteps').css('display', '');
                $('#form_continue').attr('disabled', true);
                $('#form_continue').css('display', 'none');
                $('#form_enroll').attr('disabled', false);
                $('#form_enroll').css('display', '');
                // enable form fields
                $('#FirstName').attr('disabled', false);
                $('#LastName').attr('disabled', false);
                $('#EmailAddress').attr('disabled', false);
                $('#HomePhone').attr('disabled', false);
                $('#FaxNumber').attr('disabled', false);
                $('#CompanyName').attr('disabled', false);
                $('#Role').attr('disabled', false);
                $('#Comments').attr('disabled', false);
                //display third party message since the Pharmacy will need to sign with them.
                $('#steps').append('<li>This would be the third party statement, letting the pharmacy know that the third party will be contacting them.</li>');

            } else if ((enrolled == '0') && (groupcontracting == '1') && (thirdparty == '0')) {

                // set hidden fields 
                $('input[name=enrolled]').val('0');
                $('input[name=groupcontracting]').val('1');
                $('input[name=thirdparty]').val('0');
                //show and hide appropriate parts of forms
                $('#restofform').css('display', '');
                $('#form_bottom').css('display', '');
                $('#pharmdata').css('display', 'none');
                $('#nextsteps').css('display', '');
                $('#form_continue').attr('disabled', true);
                $('#form_continue').css('display', 'none');
                $('#form_enroll').attr('disabled', false);
                $('#form_enroll').css('display', '');
                // enable form fields
                $('#FirstName').attr('disabled', false);
                $('#LastName').attr('disabled', false);
                $('#EmailAddress').attr('disabled', false);
                $('#HomePhone').attr('disabled', false);
                $('#FaxNumber').attr('disabled', false);
                $('#CompanyName').attr('disabled', false);
                $('#Role').attr('disabled', false);
                $('#Comments').attr('disabled', false);
                //display third party message since the Pharmacy will need to sign with them.
                $('#steps').append('<li>This would be the third partystatement, letting the pharmacy know that the third party will be contacting them.</li>');
                // show message to Pharmacy that they can enroll, but their group contracting entity will enroll them in products
                $('#steps').append('<li>As a pharmacy currently affiliated with a group contracting entity, you will be able to enroll in the network, but enrollment in the Preferred Network will be handled by your group contracting entity.</li>');


            } else if ((enrolled == '0') && (groupcontracting == '0') && (thirdparty == '1')) {

                // set hidden fields 
                $('input[name=enrolled]').val('0');
                $('input[name=groupcontracting]').val('0');
                $('input[name=thirdparty]').val('1');
                //show and hide appropriate parts of forms
                $('#restofform').css('display', '');
                $('#form_bottom').css('display', '');
                $('#pharmdata').css('display', 'none');
                $('#nextsteps').css('display', '');
                $('#form_continue').attr('disabled', true);
                $('#form_continue').css('display', 'none');
                $('#form_enroll').attr('disabled', false);
                $('#form_enroll').css('display', '');
                // enable form fields
                $('#FirstName').attr('disabled', false);
                $('#LastName').attr('disabled', false);
                $('#EmailAddress').attr('disabled', false);
                $('#HomePhone').attr('disabled', false);
                $('#FaxNumber').attr('disabled', false);
                $('#CompanyName').attr('disabled', false);
                $('#Role').attr('disabled', false);
                $('#Comments').attr('disabled', false);

            } else if ((enrolled == '1') && (groupcontracting == '0') && (thirdparty == '0')) {

                // set hidden fields 
                $('input[name=enrolled]').val('1');
                $('input[name=groupcontracting]').val('0');
                $('input[name=thirdparty]').val('0');
                //show & populate and hide appropriate parts of forms
                $('#restofform').css('display', 'none');
                $('#pharmdata').css('display', '');
                $('#form_bottom').css('display', '');
                $('#nextsteps').css('display', '');
                $('#form_continue').attr('disabled', false);
                $('#form_continue').css('display', '');
                $('#form_enroll').attr('disabled', true);
                $('#form_enroll').css('display', 'none');
                populate('#pharmdata', result); // set as the div the fields are in and NOT the form
                // disable form fields
                $('#FirstName').attr('disabled', true);
                $('#LastName').attr('disabled', true);
                $('#EmailAddress').attr('disabled', true);
                $('#HomePhone').attr('disabled', true);
                $('#FaxNumber').attr('disabled', true);
                $('#CompanyName').attr('disabled', true);
                $('#Role').attr('disabled', true);
                $('#Comments').attr('disabled', true);
                // show message to Pharmacy that they should check their info before proceding
                $('#steps').append('<li>If any of your information needs to be updated, please click <a href="mailto:network@company.com">here</a> to email our network support team.</li>');
                //display third partymessage since the Pharmacy will need to sign with them.
                $('#steps').append('<li>This would be the third party statement, letting the pharmacy know that the third party will be contacting them.</li>');

            } else if ((enrolled == '1') && (groupcontracting == '1') && (thirdparty == '0')) {

                // set hidden fields 
                $('input[name=enrolled]').val('1');
                $('input[name=groupcontracting]').val('1');
                $('input[name=thirdparty]').val('0');
                // show message to Pharmacy that they are good to go and have nothing further to do.
                $('#group_status_message').html('<p class="content-p">As a pharmacy both currently a Network Member and affiliated with a group contracting entity, no further steps are required. You will be enrolled into the Preferred Network by your group contracting entity.</p>');

            } else if ((enrolled == '1') && (groupcontracting == '1') && (thirdparty == '1')) {

                // set hidden fields 
                $('input[name=enrolled]').val('1');
                $('input[name=groupcontracting]').val('1');
                $('input[name=thirdparty]').val('1');
                // show message to Pharmacy that they are good to go and have nothing further to do.
                $('#group_status_message').html('<p class="content-p">As a pharmacy both currently a Network Member and affiliated with a group contracting entity, no further steps are required. You will be enrolled into the Preferred Network by your group contracting entity.</p>');

            } else if ((enrolled == '1') && (groupcontracting == '0') && (thirdparty == '1')) {

                // set hidden fields 
                $('input[name=enrolled]').val('1');
                $('input[name=groupcontracting]').val('0');
                $('input[name=thirdparty]').val('1');
                //show & populate and hide appropriate parts of forms
                $('#restofform').css('display', 'none');
                $('#pharmdata').css('display', '');
                $('#form_bottom').css('display', '');
                $('#nextsteps').css('display', '');
                $('#form_continue').attr('disabled', false);
                $('#form_continue').css('display', '');
                $('#form_enroll').attr('disabled', true);
                $('#form_enroll').css('display', 'none');
                populate('#pharmdata', result); // set as the div the fields are in and NOT the form
                // disable form fields
                $('#FirstName').attr('disabled', true);
                $('#LastName').attr('disabled', true);
                $('#EmailAddress').attr('disabled', true);
                $('#HomePhone').attr('disabled', true);
                $('#FaxNumber').attr('disabled', true);
                $('#CompanyName').attr('disabled', true);
                $('#Role').attr('disabled', true);
                $('#Comments').attr('disabled', true);
                // show message to Pharmacy that they should check their info before proceding
                $('#steps').append('<li>If any of your information needs to be updated, please click <a href="mailto:network@company.com">here</a> to email our network support team.</li>');

            }

        }
    });
    // end of 3rd party contract check
    // end of all checks



}); // document.ready()
$(文档).ready(函数(){
$('restofform').css('display','none');
$('#pharmdata').css('display','none');
$('#form_bottom').css('display','none');
$('#nextsteps').css('display','none');
$(“#组#状态#消息”).css('display','none');
$(“#附属关系”).css('display','none');
$(“#隶属关系注释”).css('display','none');
$(“#标签”).css('display','none');
$(“#affiliation”).css('display','none');
var登记;
风险价值集团合约;
第三方;
$('#UserNumber').keyup(函数检查注册(){
//获取用户ID
var userid=$('#UserNumber').val();
var input_length=$(“#UserNumber”).val().length;
函数填充(frm、数据){
$。每个(数据、函数(键、值){
$('[id='+key+']',frm.val(值);
});
}
如果(输入长度>=7){
//网络注册检查
var enlink=“enrollment\u check.php?userid=“+userid;
var gpclink=“group\u contracting\u check.php?userid=“+userid;
var bncdlink=“thirdparty_check.php?userid=“+userid;
$.getJSON(enlink,函数(结果){
控制台日志(结果);
if(jQuery.isEmptyObject(结果)){
//表明药房未注册
$('enroll#U status').addClass('badge badge Reverse');
$('注册状态').html('未注册');
登记='0';
console.log(已注册);
}如果(!jQuery.isEmptyObject(结果))为else{
//表明药房已注册
$(“#注册#U状态”).addClass(“徽章成功”);
$(“#注册状态”).html(“已注册”);
登记='1';
console.log(已注册);
}
});
//网络注册检查结束
//团体签约隶属关系检查
$.getJSON(gpclink,函数(gcresult){
控制台日志(gcresult);
如果(!jQuery.isEmptyObject(gcresult)){
//显示用户名可用
$(“#组#U状态”).addClass(“徽章成功”);
$(“#集团#U状态”).html(“集团附属”);
groupcontracting='1';
console.log(groupcontracting);
}else if(jQuery.isEmptyObject(gcresult)){
//显示用户名不可用
groupcontracting='0';
console.log(groupcontracting);
}
});
//集团合同结束检查
//第三方合同关系检查
$.getJSON(bncdlink,函数(bdresult){
console.log(bdresult);
如果(!jQuery.isEmptyObject(bdresult)){
//显示用户名可用
$(“#第三方身份”).addClass(“徽章成功”);
$('thirdparty_status').html(“第三方”);
第三方='1';
控制台日志(第三方);
}else if(jQuery.isEmptyObject(bdresult)){
//显示用户名不可用
第三方='0';
控制台日志(第三方);
}
});
//第三方检查结束
//**********此部分未执行*************
//检查变量设置为什么并相应显示
如果((已登记='0')&&(groupcontracting='0')&&(第三方='0')){
//设置隐藏字段
$('input[name=Registered]')。val('0');
$('input[name=groupcontracting]')。val('0');
$('input[name=thirdparty]')。val('0');
//显示和隐藏窗体的适当部分
$('#restofform').css('display','');
$('#form_bottom').css('display','');
$('#pharmdata').css('display','none');
$('#nextsteps').css('display','');
$('form#u continue').attr('disabled',true);
$('#form_continue').css('display','none');
$('form#u enroll').attr('disabled',false);
$('form#u enroll').css('display','');
//启用表单字段
$('#FirstName').attr('disabled',false);
$('LastName').attr('disabled',false);
$('#EmailAddress').attr('disabled',false);
$('#HomePhone').attr('disabled',false);
$('FaxNumber').attr('disabled',false);
$('#CompanyName').attr('disabled',false);
$(“#角色”).attr('disabled',false);
$(“#注释”).attr('disabled',false);
//显示第三方消息,因为药房需要与他们签名。
$(“#steps”)。追加(“
  • 这将是第三方声明,让药店知道第三方将与他们联系。
  • ”); }如果((已登记=='0')&&(groupcontracting='1')&&(第三方='0')){ //设置隐藏字段 $('input[name=Registered]')。val('0'); $('input[name=groupcontracting]')。val('1'); $('输入[nam]
    $(document).ajaxStop(function() {
        // this code will run after all AJAX events have completed
    });