【发布时间】:2016-07-19 08:17:37
【问题描述】:
我收到以下关于 AJAX 调用的错误
XMLHttpRequest 无法加载 billbrain:sellbill。跨源请求仅支持协议方案:http、data、chrome、chrome-extension、https、chrome-extension-resource。
billbrain 是我的 django 应用名称,而 sellbill 是销售发票视图的 url 名称。
以下是我的 AJAX (Django) 代码:
$.ajax({
url : "billbrain:sellbill",
type : "POST", d
data : { customer_code: input }, // data sent with the post request
// handle a successful response
success : function(json) {
console.log(json); // log the returned json to the console
console.log("success"); // another sanity check
},
});
现在,如果明确说明违反 DRY 的 url。那么,最佳做法是什么?
【问题讨论】:
-
为什么会违反 DRY? DRY 就像不要重复自己一样?