Skip to content

Instantly share code, notes, and snippets.

@ijunaid8989
Created December 30, 2015 12:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ijunaid8989/479aa158331b29b99c11 to your computer and use it in GitHub Desktop.
Save ijunaid8989/479aa158331b29b99c11 to your computer and use it in GitHub Desktop.
$("#merge_datatables").on 'click', '.action-cam', ->
$('#loading-popup').show()
host = $(this).parents('tr').find('td:nth-child(1)').text()
port = $(this).parents('tr').find('td:nth-child(2)').text()
jpg = $(this).parents('tr').find('td:nth-child(3)').text()
d = {}
d.host = host
d.port = port
d.jpg = jpg
$.ajax
url: 'merge'
data: d
type: 'get'
success: (data) ->
console.log(data)
$('#loading-popup').hide()
content = "<table class='table table-striped'>"
content += "<thead>"
content += "<tr>"
content += "<th>Name</th><th>exid</th><th>Online</th><th>Owner Name</th><th>Public</th><th>Shared Count</th><th>Created At</th>"
content += "</tr>"
data.forEach (cam) ->
content += '<tr>
<td><a href="/cameras/'+ cam[1] + '">' + cam[2] + '</a></td><td>' + cam[1] + '</td><td>' + colorMe(cam[6]) + '</td><td><a href="/users/'+ cam[9] + '">' + cam[3] + ' ' + cam[4] + '</a></td><td>' + colorMe(cam[8]) + '</td><td>' + cam[5] + '</td><td>' + cam[7] + '</td>
</tr>'
content += '</table>'
$('#dat').append content
$('#add-action').modal('show')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment