Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- completeHandler = (e, data)->
- # If the upload didn't succeed, inform the user and display debug
- # information in the console
- if data.textStatus != 'success'
- alert "Noe gikk galt. Debug informasjon er logget i konsollen"
- console.group 'Upload failure'
- console.error data.textStatus
- console.error data.result
- console.groupEnd 'Upload failure'
- # Un-disable the buttons
- selectButton.removeClass 'disabled'
- uploadButton.removeClass 'disabled loading'
- uploadButton.html 'Last opp'
- return
- # Save the response of the file upload
- self.fileUploadResponse = data.result
- # Fetch a preview of the uploaded file
- url = "#{config.api_root}/#{config.api_path_tabulardatafilepreview}"
- $.ajax url,
- type: 'POST'
- dataType: 'json'
- async: false
- data:
- 'file_handle': data.result.file_handle
- 'rownum': 5
- complete: (req, text_status)->
- # Handle errors
- if text_status != 'success'
- alert "Noe gikk galt. Debug informasjon er logget " + \
- "i konsollen"
- console.group 'Failed to receive data file preview'
- console.log text_status
- console.log req.responseText
- console.log req
- console.groupEnd 'Failed to receive data file preview'
- # Un-disable the buttons
- selectButton.removeClass 'disabled'
- uploadButton.removeClass 'disabled loading'
- uploadButton.html 'Last opp'
- # Save the preview data and initiate stage 2
- self.previewData = JSON.parse req.responseText
- self.setStage 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement