jQuery .html()的回调函数?

我有以下代码:

$.ajax({ type: 'GET', url: 'index.php?route=checkout/onepagecheckout/getpaypaldata', dataType: 'json', success: function(json) { $('#pp_info').html(json['output']); $('#payment').submit(); } }); 

ajax请求接收包含html表单的json对象,如:

 

其中包含PayPal处理订单所需的信息。 一切正常,但我相信有时在jQuery .html函数加载html内容之前提交表单。

是否有.html的回调函数? 或者我可以用来解决问题的任何其他方法? PayPal数据以HTMLforms出现,我无法更改该部分,所以我只有一个选项,它以某种方式加载html内容并提交表单!

你可以试试这个

 success: function(json) { $('#pp_info').html(json['output']).promise().done(function(){ $('#payment').submit(); }); }