Guest User

Untitled

a guest
Nov 16th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. <div class="x_content">
  2. <div class="well" style="overflow: auto">
  3. <div class="col-md-4">
  4. <div id="reportrange_right" class="pull-left" style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc">
  5. <i class="glyphicon glyphicon-calendar fa fa-calendar"></i>
  6. <span></span> <b class="caret"></b>
  7. </div>
  8. </div>
  9. </div>
  10. </div>
  11. <?php
  12. echo "<script>document.writeln(startdate)</script>";
  13. echo "<script>document.writeln(enddate)</script>";
  14. ?>
  15.  
  16. $('#reportrange_right').on('apply.daterangepicker', function(ev, picker) {
  17. console.log("apply event fired, start/end dates are " + picker.startDate.format('MMMM D, YYYY') + " to " + picker.endDate.format('MMMM D, YYYY'));
  18. var startdate = picker.startDate.format('MMMM D, YYYY');
  19. var enddate = picker.endDate.format('MMMM D, YYYY');
  20. console.log(startdate);
  21. console.log(enddate);
  22. console.log(picker.startDate.format('MMMM D, YYYY'));
  23. $.post('date2.php', {_startdate:startdate, _enddate:enddate}).done(function(){});
  24. location.href = '../production/date2.php';
  25. });
  26.  
  27. <?php
  28.  
  29. //date2.php
  30. if($_POST{'_startDate']){
  31. //Strictly speaking you don't need to make these in to new variables
  32. //It's just easier to use them later.
  33. $startDate = $_POST['_startDate'];
  34. $endDate = $_POST['_endDate'];
  35. //Now you can put the posted variables where you need them.
  36. }
  37. ?>
  38. <!-- You can also just write in the variables anywhere you like -->
  39. <p><?php echo $startDate;?></p> <!-- for example -->
  40. <div class="x_content">
  41. <div class="well" style="overflow: auto">
  42. <div class="col-md-4">
  43. <div id="reportrange_right" class="pull-left" style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc">
  44. <i class="glyphicon glyphicon-calendar fa fa-calendar"></i>
  45. <span></span> <b class="caret"></b>
  46. </div>
  47. </div>
  48. </div>
  49. </div>
  50.  
  51. <script>
  52. var startDate = '<?php echo $startDate; ?>';
  53. var endDate = '<?php echo $endDate; ?>';
  54. console.log(startDate + " : " + endDate);
  55. document.writeIn(startDate);
  56. document.writeIn(endDate);
  57. </script>
Add Comment
Please, Sign In to add comment