jQuery.ValidateをAJAXのPOST送信で使う
- 2012年07月25日
- WEB開発
$(function(){
$('#dialog').dialog({
autoOpen: false,
width: 800,
height: 700,
title: '送信フォーム',
modal:true,
resizable:true,
buttons: {
"送信": function() {
if(confirm("送信してよろしいですか?")){
if ($("#FRM").validate().form() == true) {
var params = $("#FRM").serialize();
$.ajax({
url: "http://www.hoge.com/post.php",
type: "post",
data: params,
async: false,
cache: false,
error: function(a,b){
alert(b);
},
success: function(response) {
}
});
$(this).dialog("close");
}
}
}
}
}
}
12行めの書き方が、普通のmethod=”post”の時とは違うので注意されたい。
jQuery.UI のdialogと jQueryのserializeと AJAXのPOST送信と jQuery.validateの併用方法。
よく使う黄金パターンなので、自分メモ。
検索
カレンダー
| 月 | 火 | 水 | 木 | 金 | 土 | 日 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | ||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 | 30 | 31 | ||
© 2025 Copyright OKESYS. All rights reserverd.