我正计划将数据成功从ajax传递到sweetalert。
$('#getCostScoreBtn_Broken').on('click', function(e) {
e.preventDefault();
var cm = $('#cm').val();
var mt = $('#mt').val();
var pt = $('#pt').val();
var pmh = $('#pmh').val();
var pmh2 = $('#pmh2').val();
var nu = $('#nu').val();
$.ajax({
url: baseurl + 'costscore/getcostscore',
type: 'get',
data: {'measure_category':cm, 'measure_type':mt, 'property_type':pt, 'pre_main_heating_source_for_the_property':pmh, 'post_main_heating_source_for_the_property':pmh2, 'name_of_uplift':nu},
success:function(data) {
setTimeout(function() {
swal({
title: 'Done',
type: 'info',
html: data['costscore']
})
},500);
}
});
})
当我尝试上述代码时,它没有显示html:data ['costscore']值。