如何获取dropzone对象

时间:2017-08-04 00:12:41

标签: javascript dropzone.js

我有一张表格

import csv
import datetime
import os

#Defaults
allowed_classes = set(["N001", "N002", "N003", "N004", "E001", "E002", "E003"])  # etc
default_class = "N004" #If no class is specified it is defaulted to N004

while (1):

    #Magnetic Card Reader Output & Attendance (Default = 0)
    attendance = '0'
    eqid = raw_input('Please swipe your card: ').strip().upper()
    class_ = eqid if eqid in allowed_classes else default_class
    print("Selected class", class_)


    #Day & Time Checker
    format = "%H%M%S"
    format_ = "%H%M"
    today = datetime.datetime.today()
    s = today.strftime(format) #Time in 24hour
    s2 = today.strftime(format_)
    d = datetime.datetime.today().weekday() #Day of week (0-5)
    period = 0 #If they scan it outside of the dedicated periods it defaults to period 1

    #Period Checker
    if "084500" < s < "094000":
        period = 0
    if "094000" < s < "104000":
        period = 1
    if "112000" < s < "121500":
        period = 2
    if "121500" < s < "131500":
        period = 3
    if "133500" < s < "143000":
        period = 4

    #Class Code Reader
    dataList = []
    with open('J:/attendance/Timetables/'+class_+'.csv', 'r') as csvfile:
      csvreader = csv.reader(csvfile)
      for row in csvreader:
         dataList.append(row)
    csvfile.close()

    #Class Code
    clcode = dataList[period][d] 

    #CSV Writer
    ofile = open('Attendance.csv', "a")
    writer = csv.writer(ofile, delimiter=',')
    writer.writerow([eqid, period+1, clcode, attendance]) 
    ofile.close()

我需要访问此dropzone才能从服务器获取响应。

我试过......

<form action="server.php" class='dropzone' id="my-awesome-dropzone"></form>

但似乎我没有获得实际的dropzone对象,只是jquery对象,这意味着我无法访问'success','addedfile'回调。

任何人都知道如何通过jquery选择器访问此dropzone?这样做的正确方法是什么?

PS我知道如何通过javascript实例化,并且这样做。但我想知道如何访问已经形成的dropzone,因为在我现在的情况下,这是唯一真正的选择。

0 个答案:

没有答案