Created
April 10, 2014 14:22
-
-
Save snoise/10387725 to your computer and use it in GitHub Desktop.
Ajaxに対応させるための外部javascript(一般)
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($) { | |
$(document).ready(function(){ | |
$('#loadingmessage').hide(); | |
$('#res').hide(); | |
$(document).on('click','#contactSubmit', function(){ | |
$('#loadingmessage').show(); | |
$('#res').hide(); | |
$.post( | |
paka3Contact.ajaxurl, | |
{ | |
action : 'paka3_action', | |
security : paka3Contact.security, | |
paka3_title : $("#i_t").val() , | |
paka3_contents : $("#i_c").val() | |
}, | |
function( response ) { | |
console.log( response ); | |
$("#res").html("<strong>「"+response.title+"</strong>」は送信されました"); | |
$('#loadingmessage').hide(); | |
$('#res').show(); | |
} | |
); | |
return false; | |
}); | |
}); | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment