FAQ
I'm writing a Greasemonkey script that incorporates JQuery, which I want to
POST JSON data to a catalyst application. The Catalyst application does not
exist within the same domain as the page the greasemonkey script is running
from, so I am assuming I will need to use Greasemonkey's
*GM_xmlhttpRequest*method to post the data. I am new to all of this,
so I'm just trying to
make sure my thought process is correct.

On the client side, I think I should use JSON.stringify on the Javascript
object before posting it using GM_xmlhttpRequest to the Catalyst app.

On the Catalyst side, I'm planning to use Catalyst::Controller::REST, which
should deserialize the JSON data with Catalyst::Action::Deserialize::JSON,
if I understand it correctly.

If anyone has done anything similar, I could use some pointers, as I'm new
to Catalyst and haven't worked with JSON before.

Thanks,
Mike.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20100302/e7e67256/attachment.htm

Search Discussions

  • Jay Shirley at Mar 2, 2010 at 9:44 pm

    On Tue, Mar 2, 2010 at 12:06 PM, Michael Peck wrote:
    I'm writing a Greasemonkey script that incorporates JQuery, which I want to
    POST JSON data to a catalyst application.? The Catalyst application does not
    exist within the same domain as the page the greasemonkey script is running
    from, so I am assuming I will need to use Greasemonkey's GM_xmlhttpRequest
    method to post the data.? I am new to all of this, so I'm just trying to
    make sure my thought process is correct.

    On the client side, I think I should use JSON.stringify on the Javascript
    object before posting it using GM_xmlhttpRequest to the Catalyst app.

    On the Catalyst side, I'm planning to use Catalyst::Controller::REST, which
    should deserialize the JSON data with Catalyst::Action::Deserialize::JSON,
    if I understand it correctly.

    If anyone has done anything similar, I could use some pointers, as I'm new
    to Catalyst and haven't worked with JSON before.

    Thanks,
    Mike.
    Assuming you can do the cross-domain xmlhttprequests with greasemonkey
    (I don't use Greasemonkey) then Catalyst::Controller::REST is what you
    are after.

    Just make sure that you send the "Content-type: application/json"
    header, and everything will work. I do this a lot with JSON, using
    yui3 though.

    -Jay
  • Michael Peck at Mar 2, 2010 at 10:13 pm
    Thanks, Jay. I thought I was on the right track...just wanted a little
    sanity check before coding. :)
    On Tue, Mar 2, 2010 at 4:44 PM, J. Shirley wrote:
    On Tue, Mar 2, 2010 at 12:06 PM, Michael Peck wrote:
    I'm writing a Greasemonkey script that incorporates JQuery, which I want to
    POST JSON data to a catalyst application. The Catalyst application does not
    exist within the same domain as the page the greasemonkey script is running
    from, so I am assuming I will need to use Greasemonkey's
    GM_xmlhttpRequest
    method to post the data. I am new to all of this, so I'm just trying to
    make sure my thought process is correct.

    On the client side, I think I should use JSON.stringify on the Javascript
    object before posting it using GM_xmlhttpRequest to the Catalyst app.

    On the Catalyst side, I'm planning to use Catalyst::Controller::REST, which
    should deserialize the JSON data with
    Catalyst::Action::Deserialize::JSON,
    if I understand it correctly.

    If anyone has done anything similar, I could use some pointers, as I'm new
    to Catalyst and haven't worked with JSON before.

    Thanks,
    Mike.
    Assuming you can do the cross-domain xmlhttprequests with greasemonkey
    (I don't use Greasemonkey) then Catalyst::Controller::REST is what you
    are after.

    Just make sure that you send the "Content-type: application/json"
    header, and everything will work. I do this a lot with JSON, using
    yui3 though.

    -Jay

    _______________________________________________
    List: Catalyst@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
    Searchable archive:
    http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
    Dev site: http://dev.catalyst.perl.org/
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20100302/a47f285f/attachment.htm

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedMar 2, '10 at 8:06p
activeMar 2, '10 at 10:13p
posts3
users2
websitecatalystframework.org
irc#catalyst

2 users in discussion

Michael Peck: 2 posts Jay Shirley: 1 post

People

Translate

site design / logo © 2022 Grokbase