I have a list of tasks that I allow a user to sort, currently I am working on the dragging/dropping from one container to the other.
While the dragging/dropping works, I can't get the jQuery post to fire. Not sure what's going on here.
Here is what I am currently working with for my jQuery:
<script type="text/javascript">
$(function() {
$(".sortable").sortable({
connectWith: '.connectedSortable',
cursor: 'move',
items: '.queueItem',
receive: function(event, ui) {
//Extract column num from current div id
var stageId = $(this).attr("id").replace("stage", "");
var taskId = $(ui.item).attr("id").replace("task", "");
$.ajax({
url: '/Task/EditStage',
type: 'POST',
data: { 'taskId': taskId, 'stageId': stageId }
});
}
}).disableSelection();
});
</script>
My controller action methods looks like:
[AcceptVerbs(HttpVerbs.Post), Authorize]
public ActionResult EditStage()
{
Task task = this.TaskRepository.GetTask(
int.Parse(this.Request.QueryString["taskId"]));
Stage stage = this.StageRepository.GetStage(
this.Request.QueryString["stageId"]);
task.StageId = stage.StageId;
this.TaskCommentRepository.Save();
return this.Content(string.Format("The stage for Task {0} has been changed to {1}", task.TaskId, stage.Name));
}
The user is authorized, just curious as to what I am overlooking? Going forward, how can I test this to see what the hang-up is?
Thanks in advance!