-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscripts.js
More file actions
50 lines (43 loc) · 997 Bytes
/
scripts.js
File metadata and controls
50 lines (43 loc) · 997 Bytes
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
* Created by ivanj on 22-Mar-17.
*/
var picId = 1;
var interval;
$(document).ready(function () {
$("#btnStart").click(function (e) {
e.preventDefault();
var timer = $("#srcTimer").val();
interval = setInterval(function () {
$.ajax({
url: "function.php",
type: "POST",
data: {
"timer": timer,
"numberId": picIdFormat(picId)
},
success: function (response) {
//Do nothing
}
});
picId += 1;
},timer*1000);
});
$("#btnStop").click(function () {
clearInterval(interval);
alert("It's stopped.");
});
});
var picIdFormat = function (number) {
if(number < 10)
{
return "00"+number;
}
if(number > 9 && number < 100)
{
return "0"+number;
}
if(number > 100)
{
return number;
}
};