jQuery-can';t向函数发送值
我想在更改输入字段的默认值后向函数发送数据jQuery-can';t向函数发送值,jquery,Jquery,我想在更改输入字段的默认值后向函数发送数据 function change_pos(position, new_pos) { $.post(iloc, {a:"change_pos", position:position, new_pos:new_pos}, function(d){ window.location = "[@HTTP_ADDR]/cms/gallery"; }); } <input type=\"text\" value=\"{$row[
function change_pos(position, new_pos) {
$.post(iloc, {a:"change_pos", position:position, new_pos:new_pos}, function(d){
window.location = "[@HTTP_ADDR]/cms/gallery";
});
}
<input type=\"text\" value=\"{$row['POSITION']}\" onchange=\"change_pos('{$row['POSITION']}', this)\" />
功能更改位置(位置,新位置){
$.post(iloc,{a:“更改位置”,位置:位置,新位置:新位置,函数(d){
window.location=“[@HTTP\u ADDR]/cms/gallery”;
});
}
其想法是发送当前和“新”位置。但是函数不接受它们。
注意:PHP很好!jQuery就是问题所在 将
onchange
事件中的this
替换为this.value将onchange
事件中的this
替换为this.valuethis
映射到change\u pos()
的参数是输入字段本身,而不是其中的值。尝试使用this获取值。在onchange中,映射到change\u pos()的new\u pos
参数的值是输入字段本身,而不是其中的值。尝试使用此参数获取值。在onchange
中,值此
映射到新位置
参数是输入字段本身,而不是其中的值。映射到新位置
参数的此
是输入字段本身,而不是其中的值。