SHOW:
|
|
- or go back to the newest paste.
1 | data: data, | |
2 | dataType: 'json', | |
3 | success: function(json) { | |
4 | - | var id = json[0]; //get id |
4 | + | if (json !== null) { |
5 | - | var employee = json[1]; //get employee |
5 | + | var id = json[0]; //get id |
6 | - | var date = json[2]; //get employee |
6 | + | var employee = json[1]; //get employee |
7 | - | var companyName = json[3]; //get company |
7 | + | var date = json[2]; //get employee |
8 | - | var notes = json[4]; //get company |
8 | + | var companyName = json[3]; //get company |
9 | - | var companyPhone = json[5]; //get company |
9 | + | var notes = json[4]; //get company |
10 | - | var contact = json[6]; //get company |
10 | + | var companyPhone = json[5]; //get company |
11 | - | var fulfilledStatus = json[7]; |
11 | + | var contact = json[6]; //get company |
12 | var fulfilledStatus = json[7]; | |
13 | - | for ( |
13 | + | |
14 | - | var i = 0; |
14 | + | for ( |
15 | - | i < json.length; |
15 | + | var i = 0; |
16 | - | i++) |
16 | + | i < json.length; |
17 | - | { |
17 | + | i++) |
18 | - | var item = json[i]; |
18 | + | { |
19 | var item = json[i]; | |
20 | - | if (json === null) { |
20 | + | |
21 | - | alert("No ID Found"); |
21 | + | if (json === null) { |
22 | - | } |
22 | + | alert("No ID Found"); |
23 | } | |
24 | - | if (item.fulfilledStatus == "1") { |
24 | + | |
25 | - | var checked = "style='display:none'"; |
25 | + | if (item.fulfilledStatus == "1") { |
26 | - | } |
26 | + | var checked = "style='display:none'"; |
27 | - | else { |
27 | + | } |
28 | - | var checked = ""; |
28 | + | else { |
29 | - | }; |
29 | + | var checked = ""; |
30 | }; | |
31 | - | $('#output').append("<div class='lead'><input type='hidden' class='id' name='leadId[" + item.id + "]' value=" + item.id + " /><p class='id' id='id' value=" + item.id + ">Lead ID: " + item.id + "</p><p> Date: " + item.date + "</p><p> Company Name: " + item.companyName + "</p><p>Contact: " + item.contact + "</p><p>Phone: " + item.companyPhone + "</p><p>Lead info: " + item.notes + "</p><label>Fulfilled</label><input type='checkbox' name='status[" + item.id + "]' id='status' class='status' value=" + item.fulfilledStatus + " " + checked + " /></div>"); |
31 | + | |
32 | $('#output').append("<div class='lead'><input type='hidden' class='id' name='leadId[" + item.id + "]' value=" + item.id + " /><p class='id' id='id' value=" + item.id + ">Lead ID: " + item.id + "</p><p> Date: " + item.date + "</p><p> Company Name: " + item.companyName + "</p><p>Contact: " + item.contact + "</p><p>Phone: " + item.companyPhone + "</p><p>Lead info: " + item.notes + "</p><label>Fulfilled</label><input type='checkbox' name='status[" + item.id + "]' id='status' class='status' value=" + item.fulfilledStatus + " " + checked + " /></div>"); |