I am using the Dropbox API JavaScript Chooser and want to return the data from the response into my Controller
The Javascript Options for the Dropbox API
options = {
success: function (files) {
$.ajax({
url: '/FileTransfer/FileData',
type: "POST",
dataType: "json",
//data: JSON.stringify(files[0]),
data: files,
success: function (result) {}
});
},
cancel: function () {},
linkType: "preview",
multiselect: true
};
Controller Action
My controller action currently doesn't do anything at the moment but will eventually cache the output data into a model once i can get data to be passed into it, which is hence my problem.
public JsonResult FileData(string model)
{
return Json(new { success = true });
}
Refactored code following suggestion
Javascript
options = {
success: function (files) {
$.ajax({
url: '/FileTransfer/FileData',
type: "POST",
dataType: "json",
data: { result : files},
success: function (result) {
$("#FileList").load('/FileTransfer/Cloud');
},
error : function (jQXHR, textStatus, errorThrown) { }
});
},
cancel: function () {
},
linkType: "preview",
multiselect: true
};
Controller
public JsonResult FileData(List<DropboxFile> result)
{
CacheEntity(result);
return Json(new { success = true });
}