PHP Classes

Calendar (jQuery) and existing prototype.js

Recommend this page to a friend!

      AJAX Calendar  >  All threads  >  Calendar (jQuery) and existing...  >  (Un) Subscribe thread alerts  
Subject:Calendar (jQuery) and existing...
Summary:Had to mess around with it to get it to integrate with my code
Author:Ben Trout
Date:2015-08-29 02:19:12

  1. Calendar (jQuery) and existing...   Reply   Report abuse  
Picture of Ben Trout Ben Trout - 2015-08-29 02:19:12
Nothing wrong with your code, in fact it works great, and looks great. Thanks and great job. I use prototype.js for about everything though. To be honest, the reason is ... well, because I always have. jQuery.js and prototype.js do not seem to play well together at all (this is my first time using both). As such, using prototype.js to handle the request to get your calendar, popped jQuery right in, and my code was pretty much done.

I modified some of the output statements in your code "<script ...>...</script>" to include an attribute that would be ignored in case I couldn't get to it fast enough. "<script code='inject'>..</script>". I wrote a javascript handler on the back end of the prototype.js "Ajax.Request" function I used to get the calendar, and isolated the text between the <script></script> tags using the fake attribute 'code', and then appended your intended contents to the header with a new script tag. At this point I gave it an incremented 'id' attribute. <script ... id='addon1'>%your intended code here%</script>. Once the user selected a date from your calendar, I removed the scripts for the calendar (including jQuery) and stuffed prototype.js back in.

I also made a slight change so I could use my initial HTTPRequest(prototype remember) to pass it a 'field name' for it to include in the onclick event for a date. You likely already had a way to do that, but I couldn't figure it out in the time I have had with it thus far. I will of course study it some more and use the intended method when I figure it out.

It's a ruthless hack I know, but I liked your calendar and really wanted it. Thanks again.