1.ajax post提交200却fail

Your AJAX request contains the following setting:dataType: "json"

The documentation states that jQuery:
  Evaluates the response as JSON and returns a JavaScript object. (...) The JSON data is parsed in a strict manner; any malformed JSON is rejected and a parse error is thrown.

This means that if server returns invalid JSON with a 200 OK status then jQuery fires the error function and set the textStatus parameter to "parsererror".

Solution: make sure that the server returns valid JSON. It is worth noting that an empty response is also considered invalid JSON; you could return {} or null for example which validate as JSON.


  type : "post",
  url : "" ,
  data : $("#form").serializeArray(),

3.jquer validate手机号正则表达式验证

  jquery validate.addMethod 正则表达式 (自定义验证方法)  :

  jQuery.validator.addMethod( "checkMobile",function(value,element){
    var reg = /^1[3|4|5|8][0-9]\d{8,8}$/;
    var my = false;
    if (reg.test(value))my=true;
    if(value!=''){if(!my){return false;}};
     return true;
  } ,  "  <font color='red'>请输入有效的手机号码!</font>" );

4.bootstrap多个 collapse

  $('#accordion [data-toggle="collapse"]').on('click', function () {
      $('#accordion [data-toggle="collapse"]').each(function(index,ele){

results matching ""

    No results matching ""