Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder tpeck's Avatar
    Join Date
    Oct 2002
    Location
    Sydney, Australia
    Posts
    877
    Thanks
    53
    Thanked 6 Times in 5 Posts

    adding content to jQuery dynamically

    I am trying to display a Google calendar (using FullCalendar and a plugin) and the code works fine. But I would like to dynamically alter the URL (in red below):

    Code:
        $(document).ready(function() {
    
        $('#calendar').fullCalendar({
    
            // somebody's Google calendar
            events: 'https://www.google.com/calendar/feeds/somebody%40gmail.com/public/basic',
    
            eventClick: function(event) {
                // opens events in a popup window
                window.open(event.url, 'gcalevent', 'width=700,height=600');
                return false;
            },
    
            loading: function(bool) {
                if (bool) {
                    $('#loading').show();
                }else{
                    $('#loading').hide();
                }
            }
    
        });
    
    });
    My idea is to use an input field to change the URL when required.

    It was suggested that I do something like this where 'myinput' is the id of the input field:

    Code:
    var myvalue = $('#myinput').val();
    $('#calendar').fullCalendar({
    
        // tpeck
        events: 'myvalue',
    Am I doing this correctly?

    I can already save any input I make to a mySQL database such that on page load the input displays, but the reading of the page must occur out of sequence somehow, since it doesn't invoke the calendar.

    Does anyone have any ideas?
    The difference between genius and stupidity is that genius has its limits. (Albert Einstein)

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    myvalue is a variable, so remove the quotes.

    Code:
    events: myvalue,
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •