Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. $("#trace").bind('click', $.proxy(function(event) {
  2. var button2 = $('#combo').val();
  3. if(button2 == 'default') {
  4. var trans = 'Default View';
  5. }
  6. if(button2 == 'abc') {
  7. var trans = 'abc';
  8. }
  9. $.ajax({ // ajax call starts
  10. url: 'serverside.php', // JQuery loads serverside.php
  11. data: 'button2=' + $('#combo').val(), // Send value of the clicked button
  12. dataType: 'json', // Choosing a JSON datatype
  13. success: function(data) // Variable data constains the data we get from serverside
  14. {
  15. JSGraphIt.delCanvas('mainCanvas');
  16. $('.test').html('<h1>' + trans + '</h1>'); // Clear #content div
  17. $('#mainCanvas').html(''); // Clear #content div
  18. $('#mainCanvas').append(data);
  19. JSGraphIt.initPageObjects();
  20. }
  21. });
  22. return false; // keeps the page from not refreshing
  23.  
  24. }, this));
  25.  
  26. // Boxes
  27. while($row = sqlsrv_fetch_array($result))
  28. {
  29. echo '<div id="'.$row['id'].'_block" class="block channel" style="background:';
  30.  
  31. $(document).on('click', '.block', $.proxy(function(event) {
  32. var input = $(event.target).attr('id');
  33. var lines = input.split('_');
  34. var button = lines[0];
  35. $.ajax({
  36. url: 'srv.php',
  37. data: 'button=' + button,
  38. dataType: 'json',
  39. success: function(data)
  40. {
  41. $('#content').html('');
  42. $('#content').append(data);
  43. }
  44. });
  45. return false;
  46. }, this)); // End Application Details
  47.  
  48. $(".channel").click(function () {
  49. alert('channel');
  50. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement