0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【myfriend】申請完了時にalertを出してメッセージを出したい。

Last updated at Posted at 2014-04-21
myfriend_application.html
<link rel="stylesheet" href="<{$xoops_url}>/common/css/jquery.alerts.css" type="text/css" />
<script type="text/javascript" src="<{$xoops_url}>/common/js/jquery.js"></script>
<script type="text/javascript" src="<{$xoops_url}>/common/js/jquery.alerts.js"></script>
<script type="text/javascript" src="<{$xoops_url}>/common/js/jquery.ui.draggable.js"></script>
<script type="text/javascript">
jQuery('#the-form').submit(function(event){
	//HTMLでの送信はキャンセル
	event.preventDefault();
	var jQueryform= jQuery(this);
	//送信ボタンを取得
	var jQuerybutton = jQueryform.find('button');
	//送信
	jQuery.ajax({
		url:jQueryform.attr('index.php?action=application'),
		type:jQueryform.attr('post'),
		data:jQuery.serialize(),
		timeout:10000,//単位はミリ秒
		cache:false,
		//送信前
		beforeSend: function(data){
			//ボタンを無効化し、二重送信を防止
			jQuerybutton.attr('disabled',true);
		},
		//応答後
		complate:function(data){
			//ボタンを有効化し、再送信を許可
			jQuerybutton.attr('disabled',false);
		},
		//通信成功時の処理
		done:function(data){
			//送信が成功したら完了ページに遷移
			jAlert("友達申請完了","チェック");
		},
		//通信失敗時の処理
		error:function(data){
			alert("NG");
		}
	});
});
</script>
<h4><{$titlemsg}></h4>
<form id="the-form" method="post">
<{xoops_token form=$ActionForm}>
<input type="hidden" name="auid" value="<{$auser->get('uid')}>" />
<table class="outer">
<tr>
<td class="head"><{$smarty.const._MD_MYFRIEND_AISATSU}></td>
<td class="odd"><textarea name="note" cols="50" rows="5"></textarea></td>
</tr>
<tr>
<td colspan="2" style="text-align: center;">
<button><{$smarty.const._MD_MYFRIEND_SEND}></button>
</td>
</tr>
</table>
</form>
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?