Created
February 11, 2015 17:02
-
-
Save acmisiti/9a91c72ab15722f77dfb to your computer and use it in GitHub Desktop.
fetcher autocomplete ajax call
This file contains hidden or 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
on_click_send_individual_email : function(){ | |
var valid = $("#js-template-form").validate().form(); | |
if(!valid) return; | |
var contact_pk = localStorage.getItem('contact_pk'); | |
if(!contact_pk || contact_pk === "null"){ | |
alert("You must select someone to send the email to."); | |
return; | |
} | |
var data = { | |
contact_pk : contact_pk, | |
template_pk : $('input[name=template_pk]').val(), | |
}; | |
$.ajax( { type: "POST", | |
url: '/api/v1/event_template/send/', | |
data : data, | |
beforeSend : function() { | |
NProgress.set(.75); | |
}, | |
success : function(response) { | |
FETCHER.log(['response', response]); | |
NProgress.done(); | |
if(!response.success){ | |
FETCHER.Modals['error'].set_title("Email Not Delivered") | |
FETCHER.Modals['error'].set_text(response.error) | |
FETCHER.Modals['error'].pop_modal(); | |
} | |
}, | |
error : function(){ | |
alert("Opps. This is embarrassing, and error occured. Please contact [email protected]") | |
} | |
}) | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
change alert to turn input pink please