- 其他参考:http://blog.csdn.net/dengsilinming/article/details/7825495
- http://blog.csdn.net/akon_vm/article/details/7911280
- http://blog.chinaunix.net/uid-25525723-id-368284.html
- http://wenku.baidu.com/view/e212a80c4a7302768e9939e3.html
- $(document).ready(function () {
- //定义表单提交前与提交后的处理方法及超时相关
- var options = {
- beforeSubmit:showRequest,
- success:showResponse,
- timeout:3000
- };
- $(\'#myform\').submit(function() {
- // submit the form
- $(this).ajaxSubmit(options);
- // return false to prevent normal browser submit and page navigation
- return false;
- });
- });
- function showRequest(formData, jqForm, options) {
- return true;
- }
- function showResponse(responseText, statusText, xhr, $form) {
- alert(responseText );
- }
- 表单:
- <select name="linked_nodegroups" id="alreadlist" size="15" multiple class="search_locate"></select>
- <input type="submit" class="white" value="保存关联" onclick="checkhello()"/>
- 为什么还要加onclick呢?》
- 因为select需要事先将其选择。要不然就为空了!
- 所以
- function checkhello()
- {
- var objs=document.getElementById("alreadlist").options;
- for (i=0; i< objs.length; i++)
- {
- objs[i].selected=true;
- }
- return true;
- } 定义一下这个方法!
- OK。这样就可以通过JQuery.form提交表单数据了。
- 而且可以提交select的数据哦!