admin管理员组文章数量:1356774
I have got a following code:
function sendAjax(myData){
$.ajax({
type: myData["verb"],
url: "url" in myData["url"] ? myData["url"] : "/default123",
//..............
If I don't pass "url
" as a key then I'll get the error of "Uncaught TypeError: Cannot use 'in' operator to search for 'url' in undefined
".
How do I get rid of it?
I have got a following code:
function sendAjax(myData){
$.ajax({
type: myData["verb"],
url: "url" in myData["url"] ? myData["url"] : "/default123",
//..............
If I don't pass "url
" as a key then I'll get the error of "Uncaught TypeError: Cannot use 'in' operator to search for 'url' in undefined
".
How do I get rid of it?
Share Improve this question asked Mar 3, 2013 at 6:45 Alan CoromanoAlan Coromano 26.1k55 gold badges140 silver badges215 bronze badges2 Answers
Reset to default 3url : "url" in myData ? myData["url"] : "/default123"
Do you mean this?
url: myData["url"] || "/default123",
本文标签: javascriptCannot use 39in39 operator to search forin undefinedStack Overflow
版权声明:本文标题:javascript - Cannot use 'in' operator to search for .... in undefined - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744030273a2578778.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论