小编Sun*_*Ban的帖子

如何在ajax内容加载和javascript时加载gif图像

我一直在尝试加载gif图像,直到ajax加载数据并显示它.但我感到很欣慰.

我希望你能帮帮我..这是我的高级搜索代码.

现在我想为此添加加载gif.

$.ajax({
    type: 'POST',
    url: base_rul+'site/advancedsearch',
    data: {
        keyValues: keyValues
    },
    dataType: 'json',
    success: function(data) 
    {

        var content = ['']; 
        if(data.status=='1')
        {

            //for(var k=1;k<=2;k++){

          //for chapter1 starts
          if( data.item.chapter[1] && data.item.chapter[1].length>=1){
               for(i=0;i<data.item.chapter[1].length;i++){
                  var obj = data.item.chapter[1][i];
                  //alert(data.item.chapter[1][0].chapter_row);
                    if(data.item.chapter[1][i].chapter_row==0){
                       content.push('<h3>Chapter 18 New Health Care Occupancy</h3>');
                     }

                    content.push('<ul><li><div>');
                    content.push('<p>'+obj.section_number +' '+ obj.title+'</p>');
                    content.push('</div></li></ul>');

                }//end for each loop
            }//end if
            //for chapter1 ends

         //for chapter2 starts
          if( data.item.chapter[2] && data.item.chapter[2].length>=1){
               for(i=0;i<data.item.chapter[2].length;i++){
                  var obj = data.item.chapter[2][i];
                  //alert(data.item.chapter[1][0].chapter_row);
                    if(data.item.chapter[2][i].chapter_row==0){
                       content.push('<h3>Chapter 19 Existing Health …
Run Code Online (Sandbox Code Playgroud)

html javascript css php ajax

2
推荐指数
1
解决办法
2440
查看次数

标签 统计

ajax ×1

css ×1

html ×1

javascript ×1

php ×1