Created
November 29, 2016 13:49
-
-
Save MervinPraison/cac3671ff2fb492d8976db7fe392dc28 to your computer and use it in GitHub Desktop.
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
jQuery(document).ready(function($) { | |
jQuery('button.btn').click(function() { | |
var submit_value = jQuery(this).attr("value"); | |
var ajax_contact_form = "#ajax-contact-form-"+submit_value; | |
jQuery(ajax_contact_form).submit(function(e){ | |
var cat_name = jQuery("select#cat_name-"+submit_value+" option:selected").val(); | |
var post_id = jQuery("#post_id-"+submit_value).val(); | |
jQuery.ajax({ | |
url: catform.ajax_url, | |
type: 'post', | |
data: { | |
action:'contact_forms', | |
cat_name:cat_name, | |
post_id:post_id, | |
security: catform.ajax_nonce | |
}, | |
success: function(response) { | |
jQuery('#cat-form-output-'+post_id).html( response ); //should print out the name since you sent it along | |
} | |
}); | |
return false; | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment