Add status change JS code

This commit is contained in:
dave 2014-08-26 16:28:05 -07:00
parent 7ce2c91a84
commit 276c24b0f7
1 changed files with 14 additions and 1 deletions

View File

@ -83,7 +83,20 @@ var ui = {
console.log("Couldn't save! changeName");
}})
})
})
$(this).find(".btn-group-status button").click(function(){
streamid = $(this).closest(".panel").data("streamid");
var newStatus = null
if( $(this).hasClass("btn-status-ok") ) {
newStatus = 1
} else if( $(this).hasClass("btn-status-stop") ) {
newStatus = 0
} else {
newStatus = 0
}
$.ajax("/api/changeStatus", {dataType:"json", data:{id:streamid, status:newStatus},error:function(){
console.log("Couldn't save! changeStatus");
}})
})
}
}