views:

354

answers:

0

Hi,

Does anyone know why ajaxFileUpload callback (succes) is not working on a page which use document.domain ?

I'm using document.domain in order to proceed to main/sub domain AJAX request.

UPDATE

iframe on main domain :

<iframe style="display:none;" src="sub.main.com" width="0" height="0"></iframe>

<div id="stuff"></div>
<script type="text/javascript">
document.domain = 'main.com';

iframe on sub domain :

<script type="text/javascript" language="javascript">
document.domain = 'main.com';
function pooling(){

 var query = "xid="+<?php echo $x; ?>;

 $.get("check_long.php",query, function(returned_data) {

     if( returned_data.length ) {

    parent.dropData(returned_data);

     }

     pooling();
     });

}


pooling();

</script>

Ajaxfileupload script

function ajaxFileUpload()
{


 $.ajaxFileUpload
 (
  {
   url:'doajaxfileupload.php',
   fileElementId:'fileToUpload',
   dataType: 'json',
   success: function (data, status)
   {

    if(typeof(data.msg) != 'undefined')
    {

      var query = "data=" + data.msg;

      $.post("./ajax/callbacks_photos.php",query, function(data){

        $("#vide").prepend(data);
        var block = $(".day_bloc:first");
        block.css({display:"block"});
        $(".evenement:first").hide();
        $(".evenement:first").slideDown("slow");
        $("textarea#fieldStatus").val("");
        //back to status
        closeActions("103px","1");

      }); 
    }
   }
  }
 )

 return false;

}

doajaxfileupload.php call work, and everything is executed. But the callback is not working, data.msg is unefined as long as I keep document.domain = 'main.com'; on the main page.

I guess this is an issue with iframe generated by ajaxFileUpload near

var uploadCallback = function(isTimeout)

But I can't find how to fix it.