鍍金池/ 問答/HTML5  iOS  HTML/ vue ajax問題

vue ajax問題

export default {

data(){
    return{
        url:'www.aa.com',
    }
},
mounted(){
    this.getC();
},
methods:{
    getC:function(){
        $.ajax({
            url:this.url+'/api/',
            type:'get',
            dataType:"json",
            success(res){
                console.log(res)
            }
        })
    }
}

}

假設(shè)這樣請求,為什么url會加上本地URL呢??
怎么解決??
GET http://localhost:8080/www.aa.com/api/ 404 (Not Found)

其他頁面都沒有請求,只有這一個頁面發(fā)生請求。

回答
編輯回答
避風(fēng)港

因為用了相對路徑,
解決方式是按照aa.com使用協(xié)議,加上http://https:////

2017年6月20日 21:55