- Rock Content Knowledge Base
- Ion
- Tips and Tricks
Using Ajax in Your Ion Experiences
Ion Ajax Proxy
Ion's Ajax proxy allows cross-domain (and cross-subdomain) Ajax requests within ion creatives. To use it, simply make a GET request to the proxy and pass a URL-encoded parameter "u". The value of "u" is your URL along with any associated query string data. The proxy then returns the URL's response back.
*Note: AJAX is not just some kind of javascript. AJAX stands for asynchronous javascript and xml and is usually used to make http(s) requests to an API to retrieve more data from a “3rd party source”.Implementation Example
Ion Proxy URL:
/Javascript/Proxy.aspx
Sample web service / Ajax call:
http://www.yourdomain.com/json/hints?query=dogs
Call to the proxy with this sample URL:
/Javascript/Proxy.aspx?u=http%3A%2F%2Fwww.yourdomain.com%2Fjson%2Fhints%3Fquery%3Ddogs
And Proxy.aspx will return the response from http://www.yourdomain.com/json/hints?query=dogs.
*Note that the value of "u" must be URL-encoded -- eg: encodeURIComponent("http://www.yourdomain.com/json/hints?query=dogs")
If you have any questions, please contact us on help@rockcontent.com. 😀