Last active
December 17, 2015 15:48
-
-
Save treykane/6623dcfda9d0397f846a to your computer and use it in GitHub Desktop.
Parse and handle a basic AJAX response.
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
$.post("ajax_rope_check.php", { //FORM AJAX | |
street: s.step_two_street.val(), | |
city: s.step_two_city.val(), | |
state: s.step_two_state.val(), | |
zip: s.step_two_zip.val() | |
}) | |
.done(function(response){ //AJAX RESPONSE | |
response = $.parseJSON(response);//CHANGE STR TO OBJ | |
if(response.serviceable === true) { | |
//IF TRUE DO NOTHING | |
} | |
else { //IF FALSE | |
s.step_three_not_serviceable.removeClass('is-hidden'); | |
s.step_three_serviceable.addClass('is-hidden'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment