-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathlistcopy.js
36 lines (32 loc) · 897 Bytes
/
listcopy.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
$(document).ready(init);
function init()
{
$("#source_user").focus();
$("#get_source_lists").click(function() { getUserLists($("#source_user").val()) });
$("#doCopy").click(function() { doCopy(); });
}
function getUserLists(username)
{
var data = {action: "getUserLists", username: username};
$.get('index.php', data, function(result) {
//console.log(result);
$("#source_list").empty();
$.each($.parseJSON(result), function(i, v) {
var opt = $("<option value='" + v.slug + "'>" + v.name + "</option>");
$("#source_list").append(opt);
});
});
}
function doCopy()
{
$("#working").html("werkin…");
var data = {
action: "copyLists",
source_user: $("#source_user").val(),
source_list: $("#source_list option:selected").val(),
dest_list: $("#dest_list option:selected").val()
};
$.get("index.php", data, function(result) {
$("#working").html(result);
});
}