There are several ways you could do something like this.
Whcih ones you choose would start with how you plan to get the data from the client to the server.
If you want to do basic form submits, then the action page has to do something to either display the resluts OR to redirect the client to a page that displays the results. Even if the result is just the same page the user was already on.
OK Ian, I think my original post needs a little clarification:
- The cart is not on my site; I am not the merchant;
- my site would send an item to be added to the shopping cart on the merchant's site;
- the cart page would either not show up at all, or would get closed immediately without any action needed by the purchaser.
I can't think of any way this could be done without the cooperation of the merchant whose cart is being modified – but who knows?. Am I dreaming of something impossible here?
1 person found this helpful
You need some co-operation from the merchant.
From a programming perspective, you could have your user submit to a page that runs in a very small iframe. That page can use cfhttp to talk to the merchant page.
Just what I suspected. But you never know until you ask, right?
Thank you very much, Ian and Dan for your help.
1 person found this helpful
As Dan indicates, there are lots a ways stuff like this can be done...
But you have to clearly understing and explain how the various comunications between the various systems are going to occure.
There are inline frames, redirects, cfhttp, AJAX, and web services just to name a few of the possibilities of the techniques and technologies that could be tapped for requirements like this.
But this level of abstraction takes a good, clear understanding of what happens on the client, what happend on your server what happens on the merchants server and how do each of these layers comunicate with each other.
<cfhttp method="Post" url="http://address.of.target.site/page-on-target-site?variable=value&variable_2=value_2&variab le-3=value_3&etc=etc">
This should do what you are asking.
You can load all of the variables and values of those variables (order numbers, product id, price, etc) directly into the url= part of the cfhttp line.
You then create the cfhttpparam line exactly as I have it above.. because, for whatever reason, cfhttp likes to throw an error if there are no cfhttpparam's set - even if those parameters are meaningless. The one I have above basically creates an a=a parameter, which (unless the target site actually uses 'a' as a variable name) should be meaningless, yet allow the cfhttp code to function.
I use code like this to automatically load xml sitemaps for pages to a variety of sites that use them to index for search engines and rss feeds. It causes the 'insert' to work just fine, without ever showing anything on the users browser that it even happened at all.
If you need to verify that things are working correctly while you test this out, simply add the following snippet of code after the cfhttpparam tag:
This will cause whatever results that normally would be displayed on the 'target web page' (if the information was being put into that page directly ON that target page instead of 'remotely') to show up on your page. Once you're happy with the results, just delete the File Content snippet and you should be good to go.