-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathphpindex.html
More file actions
154 lines (125 loc) · 4.55 KB
/
phpindex.html
File metadata and controls
154 lines (125 loc) · 4.55 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<!DOCTYPE html>
<html>
<head>
<script src="jquery.js"></script>
<meta charset="utf-8">
</head>
<body>
<h2>Add job</h2>
<form id="addjobform">
<input type="file" name="image" id="image">
<input type="text" name="description" placeholder="Tell about your dog" id="description">
<input type="text" name="payment" placeholder="Payment" id="payment">
<input type="email" name="email" placeholder="Email" id="email">
<input type="text" name="location" placeholder="Location (1-12)" id="location">
<input type="submit" value="Submit">
</form>
<h2>Get Job</h2>
<form id="getjobform">
<input type="text" name="area" placeholder="1-12" id="area">
<input type="submit" value="Search">
</form>
<div id="outputP"></div>
<script>
/* $('#addjob').submit(function(e) {
// var formData = new FormData($(this)[0]);
$.ajax({
url: "backend.php",
type: "POST",
data: formData,
async: true,
success: function (msg) {
console.log(msg);
},
cache: false,
contentType: false,
processData: false
});s
});
function addjob()
{
$.post('backend.php', $('#addjobform').serialize())
}*/
// this is the id of the form
$("#addjobform").submit(function(e) {
var url = "addjob.php"; // the script where you handle the form input.
$.ajax({
type: "POST",
url: url,
data: new FormData( this ),
processData: false,
contentType: false,
success: function(data0)
{
alert(data0); // show response from the php script.
}
});
e.preventDefault(); // avoid to execute the actual submit of the form.
});
$("#getjobform").submit(function(k) {
var url = "listjobs.php"; // the script where you handle the form input.
$.ajax({
type: "POST",
url: url,
data: new FormData( this ),
processData: false,
contentType: false,
success: function(data1)
{
//alert(data1); // show response from the php script.
var y = 0;
var output = JSON.parse(data1);
console.log(output);
//$("#outputP"). // "Clear"-function?
while(y < output.length)
{
if (output[y].image == "upload/") {
output[y].image = "uk_dog.png";
}
$("#outputP").append("<img style='height: 75px; width: 75px' src='http://towall.tk/" + output[y].image + "'> <br/> <p><strong>Basic Information: </strong>" + output[y].description + ", " + output[y].email + "<strong>Payment: </strong>" + output[y].payment + "<br/> <button id='btn' type='button' onclick='openjobform()'>Take Job</button> <div id='cForm" + y + "'></div><form id='takejobform' style='display: none;'><input type='email' placeholder='Your email' id='takejobemail'><input type='text' placeholder='Message' id='takejobapplication'><input type='hidden' value='" + output[y].id + "'><input type='button' value='Submit' id='subBtn' onclick='getSubmit()'></form>");
y++;
}
}
});
k.preventDefault(); // avoid to execute the actual submit of the form.
});
function getSubmit() {
alert("Not working");
/*
console.log("Submitting...");
var url = "takejob.php"; // the script where you handle the form input.
$.ajax({
url: url,
type: "POST",
//data: new FormData( this ),
processData: false,
contentType: false,
success: function(data2) {
alert(data2); // show response from the php script.
}
});
//$("#takejobform").submit();*/
};
/*$("#takejobform").submit(function(foo) {
console.log("Submitted");
var url = "takejob.php"; // the script where you handle the form input.
$.ajax({
url: url,
type: "POST",
//data: new FormData( this ),
processData: false,
contentType: false,
success: function(data2)
{
alert(data2); // show response from the php script.
}
});
foo.preventDefault(); // avoid to execute the actual submit of the form.
});*/
function openjobform() {
$("#takejobform").show();
/*$("#cForm" + formid + "").append("<form id='takejobform'><input type='text' placeholder='Message' id='message' name='message'><input type='text' placeholder='Your email' id='useremail' name='useremail'><input id='uid' name='uid' type='hidden' value='" + unid + "'><input type='submit' value='Send'></form>");*/
}
</script>
</body>
</html>