0
我在angularjs首發,我試圖做一個日誌的形式,當用戶提交表單我是連接到一個REST API URL
http://XXX/XXX/index.php/report/login/format/json
configuiring的URL時,在PostMan休息客戶端它工作正常。
不過,雖然配置的網址,angularjs如下所示和註冊爲服務
User = $resource('http://xxx/xxx/index.php/report/login/format/json',{},
{
query: { method: 'GET', isArray: true },
create: { method: 'POST' }
});
User.create({email: user.email,password: user.password});
還試圖使CORS中沒有使用的服務器端。
我得到一個404錯誤,並沒有發佈值。
任何幫助將不勝感激
看看他的資源,我不明白爲什麼要角的東西擺在體內。傳遞給'create'的第一個對象的屬性應該以請求URI作爲查詢參數('.../format/json /?email = ...'),而不是在主體中。 – link
當您發出POST請求時,參數不會出現在URI中。只有在發出GET請求時,參數纔會出現在URI中。 http://www.w3schools.com/tags/ref_httpmethods.asp – GuillaumeP
對,我忘了它是一個POST而不是GET。 – link