4

フォームを使用せずに POST を PHP スクリプトに送信しようとしています。関数は、実際の投稿部分とは別に正しく機能します。

私がここでやっていることのどこが悪いのか誰にもわかりますか?

function checkforRates(){
alert('activated');
//FUNCTION CHECKS FOR RATES FOR EACH OF THE ICPS IN LATEST CONTRACT
var count = $("#selectICP").children("option:not([disabled])").length;
success = 0
$('#selectICP option:not([disabled])').each(function() {
    opICPs = $(this).val();
    $.ajaxSetup({
        type: 'POST',
        URL: 'functions/workforce_newcontract.php',
        data: {'checkrates': 'true', 'ICP': opICPs, 'ctype': ctype},
        //data: '?checkrates=true&ICP=' + opICPs + '&ctype=' + ctype,
        success: function(result) {
            if(result == 1){    
                //THIS ICP HAS ALL METERS AND ENGINES WITH RATES
                success = success + 1;
            } else {       
                $('#contract_window_message_error_mes').html(result);
                $('#contract_window_message_error').fadeIn(300).delay(3000).fadeOut(700);
                return false;
            }
        },
        error: function() {
            $('#contract_window_message_error_mes').html("An error occured, the form was not submitted.");
            $('#contract_window_message_error').fadeIn(300).delay(3000).fadeOut(700);
        }
    });
    if(success === count){
        //CONTINUE ONTO NEXT STAGE
        alert('Success!');
    }
});
}

どうもありがとう。

4

1 に答える 1