-1

私のフォームは普通の古いJavascriptものを使用して問題なく送信されますが、使用しようとすると送信Jqueryされません

フォーム...

<form class="control_select" name="audit_delete_form" id="audit_delete_form"
       method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
            <select id="audit_id_select" name="audit_id_select">
                <option value="">Please select</option>
               <? while($row = mysqli_fetch_assoc($result)){
                    echo '<option value="'.$row['auditID'].'">'.$row['auditName'].'</option>';}?>
            </select>
          <input type="submit" name="audit_delete_submit" id="audit_delete_submit" value="" />
        </form>

php..

  if(isset($_POST['audit_delete_submit'])){
    $audit_id = $_POST['audit_id_select'];
    $sql = "UPDATE audit SET auditComplete = 1, deleted = 1 WHERE auditID = '$audit_id'";
    $result2 = mysqli_query($mysqli,$sql) or die(mysqli_error($mysqli));
   }

jクエリ...

$(document).ready(function(){
  $("#audit_delete_submit").click(function(e){
    e.preventDefault();
    var x=document.forms["audit_delete_form"]["audit_id_select"].value;
        if(x==null || x=="") {
        $.msgbox("Please select an audit", {
        type:"alert",
        buttons: [
        {type: "submit", value: "OK"}
        ]
      });
    }else{
        $.msgbox("Are you sure you want to permanently delete this audit?", {   
        type: "confirm",
         buttons : [
            {type: "submit", value: "Yes"},
            {type: "submit", value: "No"},
            {type: "cancel", value: "Cancel"}
          ]
      }, function(result){
          if(result == "Yes"){
              alert(result);
              $("form#audit_delete_form").submit()
          }
      }); 
    }
  });
});

正しい値を示すJqueryを含む、実際の送信を除くすべての作業alert(result)

4

2 に答える 2

0

私は $.msgbox lib に精通していませんが、API doc をすばやくスキャンすると、オプション オブジェクトの「成功」パラメータとしてコールバック関数を配置する必要があるように見えます。

$.msgbox("Are you sure you want to permanently delete this audit?", {   
    type: "confirm"
    , buttons : [
        {type: "submit", value: "Yes"},
        {type: "submit", value: "No"},
        {type: "cancel", value: "Cancel"}
    ]
    , success: function(result) {
        if(result == "Yes"){
            alert(result);
            $("form#audit_delete_form").submit()
         }
    }
}); 
于 2013-09-03T21:59:02.930 に答える
0

これは奇妙なトリックですがreturn false、関数の最後に a を追加すると、送信が機能するはずです。私はそこにいました、それを修正しました:)

   }
   return false;
 });
});
于 2013-09-03T21:47:57.110 に答える