Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

options.js - jquery ajax get doesn't work inside of a function

11 views
Skip to first unread message

quaz...@gmail.com

unread,
Aug 11, 2016, 3:58:02 PM8/11/16
to
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");
}
})
}

ivan gat

unread,
Aug 11, 2016, 5:36:01 PM8/11/16
to
пятница, 12 августа 2016 г., 2:58:02 UTC+7 пользователь quaz...@gmail.com написал:

quaz...@gmail.com

unread,
Aug 11, 2016, 6:26:46 PM8/11/16
to
I may just move the ajax to background script and call it via sendMessage.
0 new messages