django与ajax

来源:互联网 发布:2016cpa电影网站源码 编辑:程序博客网 时间:2024/06/07 13:54

1.


2.

function submitAddwork(){    alert('11111111111111111');    var arr=document.getElementsByName("choiceme");    var list1=[];    for(var i=0;i<arr.length;i++){            if(arr[i].checked==true){                list1.push(arr[i].value);                alert(list1);                //ajax  pkid                jQuery.ajax({                  type : "POST",                  url : "/attendance/overtime/submit/",                  dataType : "json",                  success : function(data) {                  if(data=='ok'){                      alert('Success');                    }                    else{                        alert("Error");                        }                    }                    });                 }            else{                alert('meixuanzhong');            }        }    }
3.
def submitovertime(request):    print 'hhhhhhhhh'    try:        if request.is_ajax() and request.method == 'POST':            print 'ggggggggggggggggggg'        else:            print 'success'    except :        print 'do somthong'

0 0