Index: trunk/extensions/ArticleAssessmentPilot/js/ArticleAssessment.js |
— | — | @@ -246,6 +246,7 @@ |
247 | 247 | if ( config.userID.length == 32 ) { |
248 | 248 | requestData.aaanontoken = config.userID; |
249 | 249 | } |
| 250 | + |
250 | 251 | var request = $.ajax( { |
251 | 252 | url: wgScriptPath + '/api.php', |
252 | 253 | data: requestData, |
— | — | @@ -259,8 +260,12 @@ |
260 | 261 | }, |
261 | 262 | 'afterGetRatingData' : function( data ) { |
262 | 263 | var settings = $( '#article-assessment' ).data( 'articleAssessment-context' ).settings; |
| 264 | + if (data.error) { |
| 265 | + alert(data.error.code); |
| 266 | + } |
| 267 | + |
263 | 268 | // add the correct data to the markup |
264 | | - if ( data.query.articleassessment && data.query.articleassessment.length > 0 ) { |
| 269 | + if ( data.query && data.query.articleassessment && data.query.articleassessment.length > 0 ) { |
265 | 270 | for ( var r in data.query.articleassessment[0].ratings ) { |
266 | 271 | var rating = data.query.articleassessment[0].ratings[r], |
267 | 272 | $rating = $( '#' + rating.ratingdesc ), |