Javascript Ajaxform在调用submit之前获取数据
我和你一起工作 我想提醒数据正在推送到服务器的内容Javascript Ajaxform在调用submit之前获取数据,javascript,jquery,html,ajaxform,Javascript,Jquery,Html,Ajaxform,我和你一起工作 我想提醒数据正在推送到服务器的内容 <form class='frmAppList'> <input type='hidden' name='deviceid' value='<deviceId>'> <input type='hidden' name='operationtype' value='<Coming from server>'> <input type='hidden' nam
<form class='frmAppList'>
<input type='hidden' name='deviceid' value='<deviceId>'>
<input type='hidden' name='operationtype' value='<Coming from server>'>
<input type='hidden' name='type' value='command'>
<button type="submit" class='btnAppsList button'>
APPS LIST
</button>
</form>
我如何获得设备Id,请帮助我。。。。
非常感谢….来自ajaxForm文档:
success
Callback function to be invoked after the form has been submitted. If a 'success' callback function is provided it is invoked after the response has been returned from the server. It is passed the following arguments:
1.) responseText or responseXML value (depending on the value of the dataType option).
2.) statusText
3.) xhr (or the jQuery-wrapped form element if using jQuery < 1.4)
4.) jQuery-wrapped form element (or undefined if using jQuery < 1.4)
Default value: null
好的,我知道了,但是我如何访问deviceId,如果我说
alert(form)
,它说[object,object],如果我说JSON.stringify(form)
,它抛出的错误是:在无法进行选择的输入元素上访问selectionDirection。这就是为什么我编写了console.log,而不是alert。您需要使用firebug或google chrome的开发者控制台。
success
Callback function to be invoked after the form has been submitted. If a 'success' callback function is provided it is invoked after the response has been returned from the server. It is passed the following arguments:
1.) responseText or responseXML value (depending on the value of the dataType option).
2.) statusText
3.) xhr (or the jQuery-wrapped form element if using jQuery < 1.4)
4.) jQuery-wrapped form element (or undefined if using jQuery < 1.4)
Default value: null
success : function(response,status,request,form) {
console.log(request,form);
}