我正在尝试将 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!');
}
});
}
非常感谢。