I am trying to do a jquery ajax get when user clicks submit in options.js but it won't work inside of a function. The weird thing is, if I make it synchronous, it will work. But if I make it asynchronous, nothing happens, no pass or fail. If I make it asynchronous and take it out of the function it works.
function submitOptions() {
jQuery.ajax({
url: "
http://blah.com",
dataType: 'json',
timeout: 3000, // 3 seconds
success: function(init){
console.log("pass");
},
error: function(){
console.log("fail");
}
})
}