function using ajax and return value problem
I am stumped. First plug-in project and have hit a snag.
Declaring a function which utilizes the .ajax() call will not return the data retrieved during the 'success' function.
Here is the code if anyone could tell me what I am doing wrong... thanks in advance.
- (function($){
$.rsaKey = function(proxy) {
$.ajax({
data: 'ssl-key=true',
type: 'post',
url: proxy,
success: function(response) {
return response;
}
});
}
$.fn.gibberish = function(options) {
- var options = $.extend(defaults, options);
- return this.each(function() {
- var data = $.rsaKey(options.proxy);
- alert(data);
- });
- });
- })(jQuery);