$(document).ready function
大量のデータを取得してページに表示するためにajax呼び出しがあります。約160KBのデータを返し、約6秒かかります。ほとんどの場合は正常に機能しますが、エラー関数がエラー番号403
を返す200
場合や404
、データを返さない場合があります。何が問題なのか本当にわかりません。これが私のajaxコードです:
jQuery(document).ready(function(){
URL='{% url CompanyHub.views.getServices %}';
jQuery.ajax({
url:URL,
type:'POST',
context: this,
beforeSend:function(xmlHttpRequest){
jQuery('#container').append('<img src="/static/loading.gif" id="loading" />');
},
complete:function(){
jQuery('#loading').remove();
},
success:function(data){
jQuery('#loading').remove();
jQuery('#carousel').html(data);
},
error:function(jqXHR, textStatus, errorThrown){
alert(jqXHR.status);
}
});
});