Guest User

Untitled

a guest
Dec 16th, 2017
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. $(document).ready(function() {
  2.  
  3. var my_results = $("#my_table").DataTable({
  4.  
  5. "processing": true,
  6. "serverSide": true,
  7. "ajax": {
  8. "url": "/my-internal-api-endpoint/",
  9. "data": function ( d ) {
  10. d.eventKey = $("#myInput option:selected").val();
  11. d.specKey = 0; // <- This is value which need to be changed
  12. }
  13. },
  14. "columns": [
  15. { "data": "date" },
  16. { "data": "event" }
  17. ],
  18. "fnInitComplete": function(oSettings, json) {
  19. $('#foo').val(json.foo);
  20. $('#bar').val(json.bar);
  21. }
  22. });
  23.  
  24. $('.myClass').on('click', function(){
  25.  
  26. var yoo = $(this).val();
  27. my_results.ajax.data({specKey: yoo}); // <- There is a problem
  28. my_results.ajax.reload();
  29. });
  30. $("#myInput").on('change', function() {
  31. my_results.ajax.reload();
  32. });
  33. });
Add Comment
Please, Sign In to add comment