Skip to content

Instantly share code, notes, and snippets.

@TheRyanBurke
Created March 6, 2012 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheRyanBurke/1987027 to your computer and use it in GitHub Desktop.
Save TheRyanBurke/1987027 to your computer and use it in GitHub Desktop.
jquery fileupload
offline_tracking.html
---------------------
<script src="@{'/public/js/libs/fileupload/jquery.ui.widget.js'}"></script>
<script src="@{'/public/js/libs/fileupload/jquery.iframe-transport.js'}"></script>
<script src="@{'/public/js/libs/fileupload/jquery.fileupload.js'}"></script>
#{form @APICallScriptController.newCallScript(viewModel.rDnaId), id:'newScriptForm', enctype:'multipart/form-data'}
Script name: <input type="text" id="scriptName" name="name" />
<br />
<input type="file" id="fileupload" name="scriptFile" />
<br />
<input type="submit" name="submit" value="Upload New Script" />
#{/form}
wizard-common.js
-----------------
$("#newScriptForm").submit(function(e) {
e.preventDefault();
$("#fileupload").fileupload({
//acceptFileTypes: '/(\.|\/)(txt)$/i',
dataType: 'json',
url: '/apicallscriptcontroller/newcallscript',
formData: {
rdnaid: controllerConstants.getRdnaId(),
authenticityToken: $(this).parent().find('input[name="authenticityToken"]').val()
},
send: function(e, data) {
return true;
},
done: function(e, data) {
ringDNA.calls.getCallScripts();
}
});
return false;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment