The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Easy JS Method to Clear FoxyCart Contents

swensorswensor Member
in Help edited April 2009
Hey all,

I am looking for a javascript call to clear the contents of my foxycart completely. What is it? I see the way to do it with a link, can I do it with javascript? Should I just call that link w/ ajax or wha??

swensor
Comments
  • brettbrett FoxyCart Team
    Hi Swensor.
    You probably want to try the JSONP, since that'll avoid some of the issues with cross-domain ajax:
    wiki.foxycart.com/docs:jsonp

    If you need additional help please just ask. You may have to take into account passing in the session value to your JSONP call. The JSONP is still not widely used so if you have questions let me kow and we'll improve the documentation for you.
  • Hey Brett,

    Thanks for the info, I am definitely new to JSON so I did some digging around. I can't figure out the line or two of code I need to call that command, does anyone have an example? Thanks!!

    swensor
  • brettbrett FoxyCart Team
    Hi Swensor.
    By "that command" you mean the empty=true bit?
    Search for "empty" on this page:
    http://wiki.foxycart.com/getting_started:adding_links_and_forms

    Then it's just a matter of calling it via javascript, AJAX, or JSON(P). The only potential issue is the session, so make sure you're sending that allow with your request or you could be clearing the wrong cart. Give it a try and let's see how far we can get.
Sign In or Register to comment.