I have got a problem about a ajax call function .I can't handle success or error result. This function get CalcPremium parameter as 100 .It should be change depend on ajax response ,but function again return 100. Ajax calling url is ok ,i don't understand what is problem. Here is my function :
function get_result_by_code(CalcPremium) {
var retValue = CalcPremium
var promocode = parseFloat($('#bakcelPromo').val())
var url = '/docflow/' + project_id + '/' + document_id + '/promo/extract_json/'
$.ajax({
method: "POST",
url: url,
async: true,
data: { promocode: promocode },
success: function (response) {
if (response.status == 1) {
retValue = retValue * 0.5 }
else {
retValue = retValue * 2.0 }
$('#output').html(response.message);
},
error: function () {
retValue = retValue * 4.0
}
});
return retValue;
}