我讀的鏈接https://api.jquery.com/deferred.done/Deferred.done不執行環連接的過程
然後修改我的代碼:如下
$.ajax(
{
type: 'Get',
dataType: 'json',
data: { id: id },
url: '@Url.Action("GetInsuranceClaim","Insurance")',
success: function (da) {
if (da.Message == "Success") {
var d = $.Deferred();
d.done($('#Cust_id').val(da.Result[0].customer_id), GetPolicy(), $('#policy_no').val(da.Result[0].policy_detail_id), console.log(da.Result[0].policy_detail_id));
d.done($( '#CUST_ID')VAL( console.log(da.Result [0] .policy_detail_id),() );
getPolicy方法()是AJAX調用我的問題是Ajax調用最後執行,
我需要執行順序
- $( '#CUST_ID')。VAL(da.Result [0 ] .customer_id)
- getPolicy方法()
- $( '#policy_no')。VAL(da.Result [0] .policy_detail_id)
謝謝它的作品 –