Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // AJAX call for fetching data
- $.ajax({
- url: "../resources/db_api.php",
- type: 'POST',
- dataType: 'xml',
- cache: false,
- data: {
- sp: "BS_Fetch_Salesforce_ApprovalBreakdown",
- type: "xml",
- params: {
- year: selectedYear
- }
- },
- error: function(err) {
- alert(err.statusText);
- },
- success: function(data) {
- // Do we have data?
- if (data) {
- output += '<table class="table table-condensed">';
- output += '<thead>';
- output += '<tr>';
- output += '<th class="small"><input type="checkbox" name="checkAllBreakdown"></th>';
- output += '<th class="small">Request ID</th>';
- output += '<th class="small">Month</th>';
- output += '<th class="small">Year</th>';
- output += '<th class="small">Priority</th>';
- output += '<th class="small">Title</th>';
- output += '<th class="small">Requestor</th>';
- output += '<th class="small">Date Requested</th>';
- output += '<th class="small">Desired Completion</th>';
- output += '<th class="small">Budget</th>';
- output += '<th class="small">Dev Hours</th>';
- output += '<th class="small">Size</th>';
- output += '<th class="small">Status</th>';
- output += '<th class="small">Outcome</th>';
- output += '</tr>';
- output += '</thead>';
- output += '<tbody name="breakdownResults">';
- $(data).find('requests').each(function() {
- output += '<tr requestid="' + $(this).find('requestID').text() + '">';
- output += '<td class="small"><input type="checkbox" name="cbBreakdown" class="breakdownCB" value="' + $(this).find('requestID').text() + '"></td>';
- output += '<td class="small"><a href="request.php?id=' + $(this).find('requestID').text() + '" target="_BLANK">' + $(this).find('requestID').text() + '</a></td>';
- output += '<td class="small">' + $(this).find('monthTargetName').text() + '</td>';
- output += '<td class="small">' + $(this).find('yearTargetName').text() + '</td>';
- output += '<td class="small">' + $(this).find('priorityLevel').text() + '</td>';
- output += '<td class="small">' + $(this).find('requestTitle').text() + '</td>';
- output += '<td class="small"><a href="#' + $(this).find('proposedByNTID').text() + '" target="_BLANK">' + $(this).find('proposedByFirst').text() + ' ' + $(this).find('proposedByLast').text() + '</a></td>';
- output += '<td class="small">' + $(this).find('dateRequested').text() + '</td>';
- output += '<td class="small">' + $(this).find('dateNeeded').text() + '</td>';
- output += '<td class="small">' + ($(this).find('budget').text() ? $(this).find('budget').text() : '-') + '</td>';
- output += '<td class="small">' + ($(this).find('devHours').text() ? $(this).find('devHours').text() : '-') + '</td>';
- output += '<td class="small">' + ($(this).find('size').text() ? $(this).find('size').text() : '-') + '</td>';
- output += '<td class="small">' + $(this).find('requestStatus').text() + '</td>';
- output += '<td class="small">' + $(this).find('requestOutcome').text() + '</td>';
- output += '</tr>';
- });
- output += '</tbody>';
- output += '</table>';
- // Append the output
- $('[name=breakdownPlaceholder]').empty().append(output);
- $('.breakdownFooter').show();
- } else {
- // No data returned, clean up.
- $('[name=breakdownPlaceholder]').empty().append('<br /><div class="alert alert-info"><center>No Requests Found</center></div>');
- $('.breakdownFooter').hide();
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement