1
$(document).ready(function(){
2
$("#new_projectset_form").submit(add_projectset);
3
$(".new_project").submit(add_project);
7
function serializeForm(form){
9
mylist = form.serializeArray();
11
for (var i = 0; i < mylist.length; i++){
12
data[mylist[i].name] = mylist[i].value;
18
function add_project(){
19
$(this).attr('disabled', 'disabled');
21
function callback(xhr) {
22
var response = JSON.parse(xhr.responseText);
23
var projectlist = $('#projectslist_' + response.projectset_id);
24
projectlist.append(response.html).hide();
25
projectlist.show('normal');
26
$(this).removeAttr('disabled');
29
var data = serializeForm($(this));
31
ajax_call(callback, $(this).attr("action"), "", data, 'POST');
36
function add_projectset(){
38
$("#add_projectset").attr('disabled', 'disabled');
40
function callback(xhr) {
41
var response = JSON.parse(xhr.responseText);
42
$('#projectset_list').append(response.html);
43
$('#projectset_' + response.projectset_id).hide();
44
$('#projectset_' + response.projectset_id).show('normal');
45
$("#add_projectset").removeAttr('disabled');
48
var data = serializeForm($("#new_projectset_form"));
50
data['ivle.op'] = 'add_projectset';
52
ajax_call(callback, $("#new_projectset_form").attr("action"), "", data,