Guest User

Untitled

a guest
Aug 18th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. Weird javascript error with the .split() string method in Chrome browser
  2. $(document).ready(function() {
  3. currentURL = window.location.pathname + "/order=vote/genres=/dates=";
  4.  
  5. $(".date").click(function() {
  6. var thisButton = $(this);
  7. if (thisButton.html() == 'Today') {
  8. var dateText = 'today';
  9. } else if (thisButton.html() == 'All') {
  10. var dateText = 'all';
  11. } else {
  12. var dateText = '';
  13. }
  14.  
  15. console.log(currentURL);
  16. var splitURL = currentURL.split('dates=');
  17. var filterDateURL = splitURL[0] + 'dates=' + dateText;
  18.  
  19. $.ajax({
  20. url: filterDateURL,
  21. success: function(response) {
  22. $("#show_container").html($("#show_container", response).html());
  23. $("#genre_filters").html($("#genre_filters", response).html());
  24. currentURL = filterDateURL;
  25. // add selected to this button, remove from other date filters
  26. thisButton
  27. .addClass('selected')
  28. .removeClass('unselected')
  29. .siblings("a")
  30. .removeClass('selected')
  31. .addClass('unselected');
  32. }
  33. });
  34. return false;
  35. });
  36. });
  37.  
  38. if (console && console.log){
  39. console.log(currentURL);
  40. }
Add Comment
Please, Sign In to add comment