douweinu8562 2013-11-15 23:51
浏览 29

ajax回调AWS弹性beanstalk - 跨源问题?

In the code block below, I attempt to make an ajax call ( $.getJSON()) back to my php application which I'm hosting inside AWS elastic beanstalk. The callback function doesn't seem to ever get invoked.. The same code works perfectly when hosted on my local machine.

The page making this call and the ajax page being called are both within the same AWS container, so I wouldn't think this is a cross-origin issue- but since I don't know the inner workings of how AWS hosts these things, I cant be sure if that might be the issue, or if it's something else.

 function retrievefollowerdata() {      
        console.log("entering retrievefollowerdata");
        //ajax call to get back a JSON object of *all* the followers in the targeted area + radius
            var qopts = { 
            crowdluv_tid: "<?php echo $CL_ACTIVE_MANAGED_TALENT['crowdluv_tid'];?>", 
            crossDomain: true,
            fromafar: new String(working_targetset.fromafar) 
         };

        resl = $.getJSON('<?php echo CLADDR;?>ajax_getfollowers.php', qopts, function(result) {
            console.log("entering callback, received unfiltered result:"); console.log(result);

        } );

        console.log("exiting retrievefollowerdata, resl="); console.log(resl);
    }

In the chrome console, I end up seeing: -Entering retrievefollowerdata -Exiting retrievefollowerdata, resl = {Object}

The console never prints "Entering callback, ..." -- so I assume the callback from the $.getJSON call is never being invoked.

Strangely, the resl {Object} when printed in the console appears to actually contain the data that would be returned by the ajax page. So I don't know if it's a failure making the http request, or with calling the callback...

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 微信会员卡接入微信支付商户号收款
    • ¥15 如何获取烟草零售终端数据
    • ¥15 数学建模招标中位数问题
    • ¥15 phython路径名过长报错 不知道什么问题
    • ¥15 深度学习中模型转换该怎么实现
    • ¥15 HLs设计手写数字识别程序编译通不过
    • ¥15 Stata外部命令安装问题求帮助!
    • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
    • ¥15 TYPCE母转母,插入认方向
    • ¥15 如何用python向钉钉机器人发送可以放大的图片?