Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you want to use AJAX petitions over different domains/subdomains you have to implement Cross Origin Requests.</p> <p>References:</p> <ul> <li><a href="http://hacks.mozilla.org/2009/07/cross-site-xmlhttprequest-with-cors/">http://hacks.mozilla.org/2009/07/cross-site-xmlhttprequest-with-cors/</a></li> <li><a href="https://developer.mozilla.org/en/http_access_control">https://developer.mozilla.org/en/http_access_control</a></li> </ul> <p>Examples:</p> <ul> <li><a href="http://arunranga.com/examples/access-control/">http://arunranga.com/examples/access-control/</a></li> </ul> <p>Your server needs to send this headers:</p> <ul> <li><strong>Access-Control-Allow-Origin</strong>: test1.floowie.com</li> <li><strong>Access-Control-Allow-Credentials</strong>: true // allow cookie/session credentials</li> <li><strong>Access-Control-Allow-Methods</strong>: GET, POST, PUT, DELETE, OPTIONS</li> </ul> <p>You can return the <strong>Access-Control-Allow-Origin</strong> globally or set specifically dependent of your input <strong>Origin</strong> ($_SERVER['HTTP_ORIGIN']) request header. Also apply for <strong>Access-Control-Allow-Methods</strong>.</p> <p>You <strong>must</strong> implement the <strong>OPTIONS</strong> petition. Before the first AJAX call, modern browsers call that URL with an OPTIONS method to retrieve the above headers.</p> <p>Ok this is the first part, the second is with jQuery. Read very carefully this page: <a href="http://api.jquery.com/jQuery.ajax/">http://api.jquery.com/jQuery.ajax/</a></p> <p>You will need to add some options to every AJAX call, you can do it globally:</p> <pre><code>$(document).ajaxSend(function (event, xhr, settings) { settings.xhrFields = { withCredentials: true }; }); </code></pre> <p>Or specific:</p> <pre><code>$.ajax({ url: a_cross_domain_url, xhrFields: { withCredentials: true } }); </code></pre> <p>This issue made ​​me lose <strong>many</strong> hours... hope it helps.</p> <p>Note that you won't need to set your cookie domain as ".floowie.com" if you want.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload