Last active
December 18, 2015 03:58
-
-
Save haeky/5721630 to your computer and use it in GitHub Desktop.
Example Ajax from AltitudeHardware with Play! Framework 1.2.5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var actionDevices: #{jsAction @WebAPI.devices(":typeId")/}, | |
$.ajax({ | |
url: actionDevices({ | |
typeId: id | |
}), | |
dataType: 'json', | |
success: function(result) { | |
$(".deviceList ul").empty(); | |
$.each(result, function(i,value) { | |
$("#hardwareList li.active") | |
.append($("<ul/>", {"class" : "nav nav-list"}) | |
.append($("<li/>", {"class": "draggable"}) | |
.append($("<input/>",{"type" : "hidden"}).val(value.connectors.length > 0 ? value.connectors[0].name : "")) | |
.append($("<span/>", {"class" : "label label-info"}).text(value.name).attr("onClick","altitude.hardware.showAttribute('" + value.id + "')")) | |
.append($("<input/>",{"type" : "hidden"}).val(value.id)) | |
) | |
); | |
}); | |
$(".draggable").draggable({ helper: "clone" }); | |
activateDroppable(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment