1

I'm trying to build a dynamic table in SP 2010 using the ExcelRest API and jQuery $.ajax. It works like a charm in Chrome but fails in IE.

The relevant code:

$(document).ready(function() {
    $.ajax({
        type: "GET",
        url: "http://ohc/cdc/_vti_bin/ExcelRest.aspx/SiteAssets/pm/schedule/project_schedule_data.xlsx/model/Ranges('project_schedule')?$format=atom",
        dataType: "xml",
        cache: "false",
        success: function(data, status, xhr) {
            $('row', data).each(function() {
                // IE never gets here
                $('<tr></tr>').appendTo('.wbs_table tbody');
                $('c', this).each(function() {
                    $('<td></td>').text($('fv', this).text()).appendTo('.wbs_table tbody tr:last-child');
                });
            });

            cleanupTable();
        },
        error: function(jqXHR, status, statusText) {
            alert(status + ': ' + statusText);
        },
        complete: function(xhr, status) {
            // had been debugging here
        }
    });
});

Might be worthwhile to add that this is an intranet site? So far I've confirmed that IE receives the XML document, and that the XHR responseText is the complete/correct XML string.

I've tried all the things I could find about taking the XML string and converting it into an MS XMLDOC. Using $.parseXML(data) has no effect on the behavior because IE already sees it as an XML document, and I can find all the information by navigating through the console. It's like the jQuery selectors aren't working.

Before using selectors I was using .find() with the exact same results.

$(data).find('row').each(function() {...});

I switched to the selector approach because I thought the problem might have been with .find().

This is driving me completely insane. I feel like the problem is probably due to the MIME type that ExcelRest.aspx returns?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.