That is not going to work.
Cross-domain Ajax requests don't work and are not allowed. You can only send requests to your own domain name, and cannot send ajax requests to another domain.
You can try out HtmlAgilityPack if you're using ASP.NET!
Actually what /cart/add.js
means is that it will move point to your own website's folder cart
and the file of add.js
. This way you will add the component! In this method, the origin is same, your request will be made through your website and will be sent to the website of yours.
If you want to save the data on their website, you need to use HTTP POST request with the data. And do the coding thing there, and then come back with a response! Or use a plugin for this.
Here are some main articles for cross-domain tutorials:
https://en.wikipedia.org/wiki/Cross-origin_resource_sharing
http://www.codeproject.com/Articles/185506/AJAX-Cross-Origin-HTTP-request (These guys would help you much)
https://en.wikipedia.org/wiki/Same-origin_policy (Learn here, what requests are allowed and what would fail)