代码在代码段区域中,试图将值传递给Java脚本 文件
i am trying to pass a value to a java script file using add event listener not getting any value in return. code is in the snippet section of my question
var x = document.get Element By Id("button");
x. add Event Listener("click", resolve);
var y = document. get Element By Id("x").value;
console.log(x);
console.log(y);
function resolve()`enter code here`
{if (y >= 20000)
{alert("yes greater than 20000");
} else { alert("no good");
}
}
this is my code
答案 0 :(得分:0)
您的代码不是有效的JavaScript。我将其固定在下面:
fetch(URL,
{
credentials: 'include',
method: 'POST',
body: JSON.stringify(payload),
headers: new Headers({
'Content-Type': 'application/json'
})
})