Skip to content

Instantly share code, notes, and snippets.

@ckahle33
Created August 21, 2014 01:55
Show Gist options
  • Select an option

  • Save ckahle33/0aa0210df6002f7c9812 to your computer and use it in GitHub Desktop.

Select an option

Save ckahle33/0aa0210df6002f7c9812 to your computer and use it in GitHub Desktop.
$("#taskSortable").children();
var patchList = [];
taskList.each(function(){
var $this = $(this);
var item = { resource_uri : "/api/task-adventure/"+$this.attr("id")+"/",
order : $this.index()}
patchList.push(item);
});
$.ajax({type:"PATCH",
url:"/api/task-adventure/",
data: JSON.stringify({objects : patchList}),
contentType: "application/json",
success:function(message){
alert("Task order updated.");
},
error:function(message){
alert(JSON.stringify(message));
},
async:false
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment