zhangxinxu / mobilebone

Single Page Switching bone(include page manage, events manage) for mobile web APP, Hybrid APP, Phonegap, PPT, Single-Screen PC page...
http://www.zhangxinxu.com/wordpress/?p=4381
MIT License
1.41k stars 327 forks source link

Mobilebone.ajax 不支持跨域POST提交? #196

Closed cos800 closed 5 years ago

cos800 commented 8 years ago

我服务器端已经加了:

header('Access-Control-Allow-Origin: *');

我用zeptoMobilebone一起发起请求,zepto成功了,而Mobilebone出错了, 而且设置了POST 结果变成OPTIONS提交,怎么回事?

$.post(url, data);
//return;
Mobilebone.ajax({
    url: url,
    type: 'POST',
    dataType: 'json',
    data: data,
    timeout: 10000,
    success: success,
    error: function(){
        alert('todo: 服务器级别的错误 这里要有个更友好的提示');
    }
});

截图等会传~

cos800 commented 8 years ago

a

cos800 commented 8 years ago

本想换成 zepto 的 ajax,但是 Mobilebone 的 菊花图 并没有相关控制接口。。。 莫非要做成一个页面,两朵菊花。。。

cos800 commented 8 years ago

而且 Mobilebone 的菊花并不是很美啊, 其实 我想换成 Frozen 的菊花,但好像也没有相关接口。

cos800 commented 8 years ago

Frozen 的菊花 http://frozenui.github.io/frozenjs/ui/loading/index.html

zhangxinxu commented 8 years ago
  1. 关于POST的问题,感谢反馈。
  2. 菊花可以通过CSS进行控制。
cos800 commented 8 years ago

关于菊花 能不能做成这样调用:

Mobilebone.showLoading();
Mobilebone.hideLoading();

然后有些人 想要调用自己的菊花,像我想用Frozen的,只要这样配置一下:

var Loading = {
    times: 0,
    obj: null,
    show: function() {
        if (this.times<1) {
            this.obj = $.loading({
                content:'加载中...'
            });
        }
        this.times++;
    },
    hide: function() {
        this.times--;
        if (this.times<1) {
            this.obj.loading('hide');
        }
    }
};
Mobilebone.showLoading = Loading.show();
Mobilebone.hideLoading = Loading.hide();
cos800 commented 8 years ago

这样子感觉比较科学一些~