Created
November 19, 2013 13:59
-
-
Save anonymous/7545762 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready -> | |
$('.chosen-select').chosen() | |
$('#import_form').fileupload | |
autoUpload: false | |
dataType: "json" | |
add: (e, data) -> | |
data.context = $(tmpl("template-upload", data.files[0])) | |
$('#import_form').append(data.context) | |
$("#import_button").on "click", -> | |
$("#import_form").triggerHandler "fileuploadsubmit" | |
progress: (e, data) -> | |
if data.context | |
progress = parseInt(data.loaded / data.total * 100, 10) | |
data.context.find('.bar').css('width', progress + '%') | |
$('#import').click -> | |
alert('Data submitted for processing') | |
$('#import_form').on("ajax:success", (e, data, status, xhr) -> | |
console.log("It works") | |
).bind("ajax:error", (e, xhr, status, error) -> | |
alert(error) | |
) |
Still getting 500 Internal Server Error? You have problem with sending files onclick only or not?
About 500 Error: it the sever error. I can help if you show me the request and it content. Can you copy request body and headers here?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I changed the code to the following but still getting 500 Internal Server Error on button click