Has anyone used FullCalendar(http://arshaw.com/fullcalendar/) with Ramaze? I'm can't get it to show the events I'm passing back (AJAX) from my controller. I'm definitely getting the request. Here's the controller code:
def show_calendar @page_javascript = 'show_calendar' if request.xhr? # came from ajax request # Create a JSON "object" of the choice that can in through the post # request and the current time. For the time, we need to enclose it # in double quotes so that it will be interpreted as a string. # "{ choice: #{request['choice']}, time: \"#{Time.now}\" }"
> Has anyone used FullCalendar(http://arshaw.com/fullcalendar/) with Ramaze?
> I'm can't get it to show the events I'm passing back (AJAX) from my
> controller. I'm definitely getting the request. Here's the controller code:
> def show_calendar
> @page_javascript = 'show_calendar'
> if request.xhr? # came from ajax request
> # Create a JSON "object" of the choice that can in through the
> post
> # request and the current time. For the time, we need to enclose
> it
> # in double quotes so that it will be interpreted as a string.
> # "{ choice: #{request['choice']}, time: \"#{Time.now}\" }"
> Has anyone used FullCalendar(http://arshaw.com/fullcalendar/) with Ramaze?
> I'm can't get it to show the events I'm passing back (AJAX) from my
> controller. I'm definitely getting the request. Here's the controller code:
> def show_calendar
> @page_javascript = 'show_calendar'
> if request.xhr? # came from ajax request
> # Create a JSON "object" of the choice that can in through the
> post
> # request and the current time. For the time, we need to enclose
> it
> # in double quotes so that it will be interpreted as a string.
> # "{ choice: #{request['choice']}, time: \"#{Time.now}\" }"
> You can see I've tried a couple of different ways of passing (straight
> string and then using the JSON plugin).
Instead of "return json", try "respond(json, 200)".
If you just return the string, it will be wrapped in your layout, or
completely ignored
if you have a view for that action.
(I am not sure if it is necessary to use that second parameter with
respond, but I don't have
Ramaze docs open at the moment)
On Tue, Sep 15, 2009 at 2:11 AM, hrnt <aotu...@gmail.com> wrote:
> On 15 syys, 01:42, Scott LaBounty <slabou...@gmail.com> wrote:
> > Has anyone used FullCalendar(http://arshaw.com/fullcalendar/) with
> Ramaze?
> > I'm can't get it to show the events I'm passing back (AJAX) from my
> > controller. I'm definitely getting the request. Here's the controller
> code:
> > def show_calendar
> > @page_javascript = 'show_calendar'
> > if request.xhr? # came from ajax request
> > # Create a JSON "object" of the choice that can in through
> the
> > post
> > # request and the current time. For the time, we need to
> enclose
> > it
> > # in double quotes so that it will be interpreted as a
> string.
> > # "{ choice: #{request['choice']}, time: \"#{Time.now}\" }"
> > You can see I've tried a couple of different ways of passing (straight
> > string and then using the JSON plugin).
> Instead of "return json", try "respond(json, 200)".
> If you just return the string, it will be wrapped in your layout, or
> completely ignored
> if you have a view for that action.
> (I am not sure if it is necessary to use that second parameter with
> respond, but I don't have
> Ramaze docs open at the moment)
I'll give this a try today, but I do have the line:
layout(:page){ !request.xhr? }
that should make it so that it doesn't use the layout for this. The respond
does make it more clear though, what's going on, so I'll give it a shot.
On Tue, Sep 15, 2009 at 7:17 AM, Scott LaBounty <slabou...@gmail.com> wrote:
> On Tue, Sep 15, 2009 at 2:11 AM, hrnt <aotu...@gmail.com> wrote:
>> On 15 syys, 01:42, Scott LaBounty <slabou...@gmail.com> wrote:
>> > Has anyone used FullCalendar(http://arshaw.com/fullcalendar/) with
>> Ramaze?
>> > I'm can't get it to show the events I'm passing back (AJAX) from my
>> > controller. I'm definitely getting the request. Here's the controller
>> code:
>> > def show_calendar
>> > @page_javascript = 'show_calendar'
>> > if request.xhr? # came from ajax request
>> > # Create a JSON "object" of the choice that can in through
>> the
>> > post
>> > # request and the current time. For the time, we need to
>> enclose
>> > it
>> > # in double quotes so that it will be interpreted as a
>> string.
>> > # "{ choice: #{request['choice']}, time: \"#{Time.now}\" }"
>> > You can see I've tried a couple of different ways of passing (straight
>> > string and then using the JSON plugin).
>> Instead of "return json", try "respond(json, 200)".
>> If you just return the string, it will be wrapped in your layout, or
>> completely ignored
>> if you have a view for that action.
>> (I am not sure if it is necessary to use that second parameter with
>> respond, but I don't have
>> Ramaze docs open at the moment)
> I'll give this a try today, but I do have the line:
> layout(:page){ !request.xhr? }
> that should make it so that it doesn't use the layout for this. The respond
> does make it more clear though, what's going on, so I'll give it a shot.
generally when troubleshooting AJAX issues, I rely on the Net tab in
Firebug to show me the output of the requested page.
I find any extraneous output on that page (error messages, warnings)
will break the AJAX call and the function handling the response will
not know what to do with the mangled response.
On Tue, Sep 15, 2009 at 12:42 AM, Scott LaBounty <slabou...@gmail.com> wrote:
> Has anyone used FullCalendar(http://arshaw.com/fullcalendar/) with Ramaze?
> I'm can't get it to show the events I'm passing back (AJAX) from my
> controller. I'm definitely getting the request. Here's the controller code:
> def show_calendar
> @page_javascript = 'show_calendar'
> if request.xhr? # came from ajax request
> # Create a JSON "object" of the choice that can in through the
> post
> # request and the current time. For the time, we need to enclose
> it
> # in double quotes so that it will be interpreted as a string.
> # "{ choice: #{request['choice']}, time: \"#{Time.now}\" }"
I hadn't seen that before and yes, I can see where that would be really
useful. I'm going to try with my not working version just to see what I get
there.
Thanks!
Scott
On Mon, Sep 14, 2009 at 10:28 PM, Greg Saunderson <greg.saunder...@gmail.com
> generally when troubleshooting AJAX issues, I rely on the Net tab in
> Firebug to show me the output of the requested page.
> I find any extraneous output on that page (error messages, warnings)
> will break the AJAX call and the function handling the response will
> not know what to do with the mangled response.
> Not sure if that's at all useful to you.
> Cheers,
> Greg
> On Tue, Sep 15, 2009 at 12:42 AM, Scott LaBounty <slabou...@gmail.com>
> wrote:
> > Has anyone used FullCalendar(http://arshaw.com/fullcalendar/) with
> Ramaze?
> > I'm can't get it to show the events I'm passing back (AJAX) from my
> > controller. I'm definitely getting the request. Here's the controller
> code:
> > def show_calendar
> > @page_javascript = 'show_calendar'
> > if request.xhr? # came from ajax request
> > # Create a JSON "object" of the choice that can in through
> the
> > post
> > # request and the current time. For the time, we need to
> enclose
> > it
> > # in double quotes so that it will be interpreted as a
> string.
> > # "{ choice: #{request['choice']}, time: \"#{Time.now}\" }"