Last active
March 28, 2018 06:40
-
-
Save yasaryousuf/4b9fd28536f75c95363cc3c5cad81854 to your computer and use it in GitHub Desktop.
[WP AJAX]
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
<script> | |
jQuery(function($){ | |
$('#eventStatus').on('change', function (e) { | |
var status = this.value; | |
e.preventDefault(); | |
$('#eventStatus').fadeOut(300); | |
console.log("testing"); | |
$.ajax({ | |
url: WPAJAX.ajaxurl, | |
type: 'post', | |
data: { | |
action: 'get_event_by_status', | |
eventStatus: status | |
}, | |
}) | |
.done(function (result) { | |
var data = $.parseJSON(result); | |
var options = ""; | |
for(var i in data){ | |
options += "<option value='"+ data[i].event_id +"'>"+data[i].event_name+"</option>"; | |
} | |
}) | |
$('.rsvp-name').selectpicker('destroy'); | |
$('.rsvp-name').append(options); | |
$('.rsvp-name').selectpicker('refresh'); | |
}); | |
</script> | |
////////////////////////////////////////////////////////////// | |
<?php | |
public static function init() | |
{ | |
$self = new self(); | |
add_action("wp_ajax_username_check", array($self, 'usernameCheck')); | |
add_action("wp_ajax_email_check", array($self, 'emailCheck')); | |
add_action("wp_ajax_get_event_by_status", array($self, 'getEvent')); | |
//add_action( "wp_ajax_nopriv_check_valid_zip", array($self, 'ZipValidity') ); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment