I’m building a Shopify website and I’m trying to create a simple “Contact Us” page that allows the user to POST their comments (e.g. name, email, comments). The Shopify website is hosted (as all Shopify accounts are) but I can set up a CNAME from my domain to point the Shopify hosted pages (that way I have a vanity URL).
I’m wondering, will this enable me to POST directly from the Shopify hosted pages to a script on my server?
Example:
The Shopify pages are at: http://myawesomestore.shopify.com
On my contact-us page: http://myawesomestore.shopify.com/pages/contact-us/
I want to POST to a script on my domain (where I can store in a database): http://www.my-domain.com/contact-us.php
If I cannot do this, what is the best solution for posting from a hosted solution to an owned solution (i.e. I cannot set up a proxy on their domain to POST to mine).
I hope this makes sense, I’m still very much a novice and there are just too many fundamentals here to comprehend before I could logically build this solution myself.
Thank you all so much in advance!
Cheers,
Rob
POSTing a Form to any URL on the internet is never a problem. It doesn’t matter if it’s on the same domain or a different domain.
You can set up a contact form on your Shopify store and have it send a POST request to any URL where your custom application is listening to.
So the short answer is: This is absolutely no issue, just go ahead and add the form to your shop!
Some confusion on the topic might be caused by “Cross Domain AJAX”. If you’re doing your POST requests via Javascript then yes, it is only possible to do so if the target URL is on the same domain as the source that is sending the request. See also http://snook.ca/archives/javascript/cross_domain_aj
Hope this clears this up!