使用ajax提交没有刷新页面的图像

时间:2014-02-18 16:44:07

标签: jquery ajax

大家好我提交表单时遇到问题其他变量已提交并插入数据库但图像不是..

这是我的代码..

我想通过验证提交表单,并提交图片但不能正常工作..

    <script type="text/javascript">
    $(document).ready(function(){
  $("#form2").validate({
         debug: false,
   rules:{

    icode: {
      required: true,
      maxlength: 30,
    },

    iname: {

      required: true,
      minlength: 5,
    },

    brandname: {

      required: true,
      minlength: 5,
    },

    bb: {

      required: true,
    },




   },
   messages: {

    icode: {
    required: "Please Enter Your Location Code",
    maxlength: "Item Code not greater than 30",

    },

    iname: {
      required: "Please Enter Item name",
      minlength: "Item Name Must at least 5 character",

    },

    brandname: {
      required: "Please Enter brand name",
      minlength: "Brandname Must At least 5 character",

    },

    bb: {

      required: "Please upload Image",
    },

   },

   submitHandler: function(form) {

    $.post('item-exec.php', $("#form2").serialize(), function(data) {
     $('#result').html(alert('Station Information Added'))
     $('#result').html(window.open('item.php', '_self'))


    });
   }
  });
 });

    </script>

0 个答案:

没有答案