modifyforcommbo.js 1.6 KB

123456789101112131415161718192021222324252627282930313233
  1. $(document).ready(function() {
  2. var options = {
  3. //target: '#output1', // 用服务器返回的数据 更新 id为output1的内容.
  4. beforeSubmit: showRequest, // 提交前
  5. success: showResponse, // 提交后
  6. //另外的一些属性:
  7. //url: url // 默认是form的action,如果写的话,会覆盖from的action.
  8. //type: type // 默认是form的method,如果写的话,会覆盖from的method.('get' or 'post').
  9. //dataType: null // 'xml', 'script', or 'json' (接受服务端返回的类型.)
  10. //clearForm: true // 成功提交后,清除所有的表单元素的值.
  11. resetForm: false // 成功提交后,重置所有的表单元素的值.
  12. //由于某种原因,提交陷入无限等待之中,timeout参数就是用来限制请求的时间,
  13. //当请求大于3秒后,跳出请求.
  14. //timeout: 3000
  15. };
  16. //alert("=============") ;
  17. //'ajaxForm' 方式的表单 .
  18. $('#f1-form').ajaxForm(options);
  19. //或者 'ajaxSubmit' 方式的提交.
  20. //$('#myForm').submit(function() {
  21. // $(this).ajaxSubmit(options);
  22. // return false; //来阻止浏览器提交.
  23. //});
  24. });
  25. // 提交前
  26. function showRequest(formData, jqForm, options) {
  27. }
  28. // 提交后
  29. function showResponse(responseText, statusText) {
  30. $("#f1formmsg").html(responseText);
  31. }