This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajax({ | |
url:'',//データを送る相手側のURL | |
type:'',//ここはpop,getを記入する。使用用途によって変わってくる。 | |
cache: ,//キャッシュを使うかどうか(IE使う時はfalseを常に利用。trueにするとキャッシュが生きてくる。) | |
dataType:'',//帰ってくる値の設定。xml, script, json, jsonp,textから選択可能。俺の場合はjsonかtext | |
data:{'key':'value'},//送信するデータを記入する。変数利用可 | |
success:function(mydata){ | |
//ここに書く項目は通信がうまく行った時の処理 | |
}, | |
error:function(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//ページの初期化 | |
$(function(){ | |
//カーソル外した動作 | |
$('#ID名').blur(function{ | |
//取得したい項目を取得 | |
//入力値チェック(例:if 取得変数.match(/[^0-9a-zA-Z]/)この場合は大文字小文字英字・数字を確認する) | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//セット | |
localStorage.setItem('キー値','値'); | |
//ゲット | |
localStorage.getItem('キー値'); | |
//削除 | |
localStorage.removeItem('キー値'); | |
//バルス(全削除) | |
localStorage.clear(); | |
//セット(JSON利用するとき) | |
localStorage.setItem('キー値',JSON.stringify('値')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 日付取得 | |
nowDate = new Date(); | |
nowYear = nowDate.getFullYear(); | |
nowMonth = nowDate.getMonth() + 1; | |
nowDate = nowDate.getDate(); | |
nowYMD = nowYear + "年" + nowMonth + "月" + nowDate + "日"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//日付取得 | |
nowDate = new Date(); | |
nowYear = nowDate.getFullYear(); | |
nowMonth = nowDate.getMonth() + 1; | |
if(nowMonth >= "1" && nowMonth <= "9"){ | |
nowMonth = "0" + nowMonth; | |
} | |
nowDate = nowDate.getDate(); | |
if(nowDate >= "1" && nowDate <= "9"){ | |
nowDate = "0" + nowDate; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#money').css('変えたいCSS','値'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//table要素の削除 | |
$('.操作したい項目').empty(); | |
//table要素の追加 | |
$('.操作したい項目').eq(-1).append('追加したいTable要素'); | |
//table要素への挿入 | |
$('.操作したい要素 .操作したいIDまたはクラス').eq(-1).val(挿入したい変数); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//これはGmaps.jsを利用した時に使用できます。 | |
//htmlファイルにgmaps.js他以下の設定が必要です。 | |
//Webサーバにgmaps.js我は言っている前提で書いてます。 | |
//<script src='jquery-2.1.1.min.js'></script> | |
//<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> | |
//<script src='gmaps.js'></script> | |
$(document).ready(function(){ | |
//マップの表示設定 | |
map = new GMaps({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//OpenLayerを使ったOpenStreetMapの地図の表示などを行っています。 | |
//htmlファイルに以下の設定が必要です | |
//<script src='jquery-2.1.1.min.js'></script> | |
//<script src='OpenLayers.js'></script> | |
var map , layer; | |
$(function() { | |
//マップ変数の設定 | |
var map = new OpenLayers.Map("map_canvas"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//mysql_real_escape_stringはPHPとMySQLを接続するためのエスケープ処理です。 | |
//なぜmysql_real_escape_stringとtrimを組み合わせているかというとエスケープ処理しても空白を許容してはSQLインジェクションの元だからです。 | |
mysql_real_escape_string(trim(変数名)); | |
//今後はこっちが主流になるようです。 | |
mysqli_real_escape_string(データベース接続詞,trim(変数名)); |
OlderNewer