AJAX call cross domain issue

I am trying to login to my wordpress site using ajax call, which i asked in previous question. It should not respond anything back. But whenever i call this ajax function, Firefox(firebug) is showing 200 OK in red. This must be a cross domain issue. Tried too many things but no luck so far. Here is the code:

$.ajax({
         type: "POST",
         url: "http://path-to-wordpress/wp-login.php",
         data:myData
         success: function(data){

         },
        error: function (xhr, ajaxOptions, thrownError) {

        }   
});

Any suggestion will be appreciated.

Related posts

Leave a Reply

4 comments

  1. I assume your JS code is on abc.com and your wordpress site is dev.abc.com.

    To fix cross domain issue, just add the following code to .htaccess file to your wordpress site (dev.abc.com)

    SetEnvIf Origin "^http(s)?://(.+.)?(abc.com)$" origin_is=$0 
    Header always set Access-Control-Allow-Origin %{origin_is}e env=origin_is
    

    Just replace (abc.com) with a proper site name. For eg: (google.com) or (yahoo.com)