使用JQUERY从RSS中提取数据

时间:2016-06-22 23:38:11

标签: javascript jquery xml rss

目的:

从RSS源中提取数据,一次最多显示5个数据条目。

问题:

供参考的网址:https://www.goughrecruitment.com/t/ella-toohey

当前的问题是当数据增加超过5个条目时,浏览器将显示错误消息" Stopped scripting"。

代码:

JavaScript的:

if( $('#jobList-sector.consultant-job-posting').length ){
       var candidateJobList = $('#jobList-sector.consultant-job-posting').data('url');
       if( candidateJobList.trim() != '' ){
           //candidateJobList = candidateJobList + '&addlocation=1&addworktype=1]';
           $("#jobList-sector.consultant-job-posting").addClass('loading');
           $("#jobList-sector.consultant-job-posting").includeFeed({
               baseSettings: {
                   rssURL: [candidateJobList || "/job/rss.aspx"],
                   limit: 5

               },

               templates: {
                       itemTemplate: '<div class="col-md-4 col-sm-6"><div class="white-bg"><header class="jobpost-head"><time>{{pubDate}}</time>'+
                       '<h3><a href="{{link}}" title="{{title}}">{{title}}</a></h3></header>'+
                       '<div class="jobpost-desc">{{description}}</div></div></div>'
                   },




               complete: function () {
                   if ($(this).children().length ){
                       if( $(window).width() > 767 )   {
                           $(this).children().children().equalHeights();
                       }
                   }else{
                       $(this).append('<p>No job posted yet!</p>');
                       $(this).parent().find('.btn').remove();
                   }
                   $(this).removeClass('loading');
               }
           });


       }else{
           $('.current-positions, .consultant-link-wrapper .view-all-jobs').hide();
       }
   }

0 个答案:

没有答案