2012-03-02 23:52



I have this Jquery AJAX request to process the creation of Word documents (using PHPWord). The reports are processed and, as far as I am aware, I should not get an error. Whilst the reports are processed, I cannot get the 'data' response from the page, which returns the processed file's name which is needed to provide download links.

The AJAX request looks like this (it is based upon list items with the class 'selected'):

$('.selectionList.unprocessed li.selected').each(function(index) {
    params = 'reportNo=' + ($(this).index() + 1);
        url: 'word/export.php',
        data: params,
        dataType: 'script',
        type: 'post',
        success: function(data) { 
        error: function(jqXHR, textStatus, errorThrown) {
            alert('failure ' + textStatus + ' and ' + errorThrown); 

increaseProgressBar() just increases the width of the coloured part of a progress bar.

The errors I get in the alert boxes are either:

failure parsererror and SyntaxError: Unexpected identifier

or (both are received seemingly randomly)

failure parsererror and SyntaxError: Unexpected identifier

I attempted to post to this page using a form and that worked fine and the page echoed the correct response.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • dougang5993 dougang5993 9年前

    Very simple solution - I just need to change the dataType from script to text and the rest of it works fine.

    点赞 评论 复制链接分享