根据入参paramName,从请求url中查找出与paramName名称匹配的请求参数的值。
比如:
假设请求的URL为“http://xxx/xxx?a=1&b=2&c=3”
则getParam("a")的返回值为“1”
感谢,编写get方法后解决了问题
是为了之前CORS的时候发出简单请求。
xhrFields:{withCredentials:true},//session跨域
ajax里要加这个,前面有一节讲跨域的,跟着那个不要改动就行
可以尝试在浏览器控制台上输入data.data来检验后端是否带数据过来了
g_itemVO是不是定义在全局了
少了一步在sources获取信息成功处的打点后刷新吧,不然控制台输进去是获取不到的
问题找到了,把另一个表的id也复制到 itemmodel中了?
看下自己的前后变量名称是否一致,然后再右击页面点击检查,看看出错在哪里
function getParam(paramName) { paramValue = "", isFound = !1; if (this.location.search.indexOf("?") == 0 && this.location.search.indexOf("=") > 1) { arrSource = unescape(this.location.search).substring(1, this.location.search.length).split("&"), i = 0; while (i < arrSource.length && !isFound) arrSource[i].indexOf("=") > 0 && arrSource[i].split("=")[0].toLowerCase() == paramName.toLowerCase() && (paramValue = arrSource[i].split("=")[1], isFound = !0), i++ } return paramValue == "" && (paramValue = null), paramValue }
设置个断点,看下全局异常处理器那个exception是啥
先debug一下看看那个环节出现问题了
同样是这个错误,
data.data
VM101:1 Uncaught ReferenceError: data is not defined
at <anonymous>:1:1
函数是照着评论区里的同学提供的copy的,代码照着老师的敲进去的。
调试界面,看到报文头有问题,id没有传进去:
Request URL:
http://localhost:8090/item/get?id=
Request Method:
GET
Status Code:
200
Remote Address:
[::1]:8090
Referrer Policy:
no-referrer-when-downgrade
function getParam(paramName) { paramValue = "", isFound = !1; if (this.location.search.indexOf("?") == 0 && this.location.search.indexOf("=") > 1) { arrSource = unescape(this.location.search).substring(1, this.location.search.length).split("&"), i = 0; while (i < arrSource.length && !isFound) arrSource[i].indexOf("=") > 0 && arrSource[i].split("=")[0].toLowerCase() == paramName.toLowerCase() && (paramValue = arrSource[i].split("=")[1], isFound = !0), i++ } return paramValue == "" && (paramValue = null), paramValue }