Created
May 25, 2020 11:56
-
-
Save funkysoul/ce11aebb5821e5ce676b2a9d6e463018 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.ajax({ | |
type : "post", | |
dataType : "json", | |
url : wpajaxurl.ajaxurl, | |
data : {action: "signupform", form_id : 37 }, | |
success: function(response) { | |
if(response.success) { | |
jQuery('#formcontainer').append(response.form); | |
} | |
else { | |
alert("no matching form found"); | |
} | |
} | |
}); |
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 stf_grab_signupform() { | |
$catID = $_POST['form_id']; | |
$formID = 37; | |
/*switch($catID) { | |
case 'a': | |
$formID = 37; | |
break; | |
case 'b': | |
$formID = 38; | |
break; | |
case 'c': | |
$formID = 39; | |
break; | |
}*/ | |
$formToShow = gravity_form( $formID, false, false, false, '', true, 1, false ); | |
echo json_encode(array('success' => true, 'form' => $formToShow)); | |
$result = null; | |
die(); | |
} | |
add_action( 'wp_ajax_signupform', 'stf_grab_signupform' ); | |
add_action( 'wp_ajax_nopriv_signupform', 'stf_grab_signupform' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment