我的代码如下:
$("#member_country").change(function() {
var country = $(this).val();
alert(country);
var ajax_url_mtypes = ins_membership_ajax.ajax_url + \'?action=ins_get_membershiptypes_from_country&country=\'+country;
alert(ajax_url_mtypes);
jQuery.ajax({
url:ajax_url_mtypes,
method:\'GET\',
contentType: "application/json;charset=utf-8",
success:function(response) {
//var resp = $.trim(response);
alert(response);
//$("#ins-member-profile-select-state").html(resp);
}
});
add_action(\'wp_enqueue_scripts\',array(INS_Membership::get_instance(),\'ins_event_front_scripts\'));
public function ins_event_front_scripts(){
wp_register_script(\'member-front-script\',plugins_url(\'/js/member-front-script.js\', __FILE__),array(\'jquery\'),\'1.1\',true);
//localize script for ajax url
wp_localize_script( \'member-front-script\',\'ins_membership_ajax\', array(
\'ajax_url\' => admin_url(\'admin-ajax.php\')
));
wp_enqueue_script(\'member-front-script\');
//enqueue styles
wp_register_style(\'member-front-styles\',plugins_url(\'/css/member-front-styles.css\', __FILE__));
wp_enqueue_style(\'member-front-styles\');
}
add_action(\'wp_ajax_ins_get_membershiptypes_from_country\',array(INS_Membership::get_instance(),\'ins_get_membershiptypes_from_country_callback\'));
我收到了Ajax调用的0响应。我应该怎么做才能解决这个问题?