// 发送信息
function send() {
// console.log()
data.push({
status: 2,
userId: '2',
img: 'k1.png',
time:getTodayBegin() ,
content: $('#send_content').val()
})
render_page({
status: 2,
userId: '2',
img: 'k1.png',
time:getTodayBegin(),
content: $('#send_content').val()
})
location.href = "/yydata/?content="+('#send_content').val(); //重新打开当前页面(附加参数)
$('#send_content').val('')
}
想把javaScript变量传递asp页面 存入数据库获取值 不是空 就是 undefined
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
5条回答 默认 最新
CSDN专家-showbo 2021-06-23 17:54关注content的值为undefined?说明send_content这个id对象不存在,自己检查下id拼写是否正确
如果send_content异步加载的,你需要改下send方法的调用位置,要在send_content加载到dom后,并且赋值后再执行send调用
看你代码data是数组,数组没有content属性的。所以是undefined
location.href = "/yydata/?content="+data.content;
===》
location.href = "/yydata/?content="+$('#send_content').val();
重新获取控件值就行了。
不过你用location.href跳转,当前页面就没有内容了呢。。放url后面是get请求,用request.querystring("content")或者request("content")获取,不能用人Request.form,form是post请求
帮助到你可以点个采纳吗,谢谢,有什么问题可以继续问~
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报