String.prototype.getLanguage = function() {
$.getJSON('http://ajax.googleapis.com/ajax/services/language/detect?v=1.0&q=' + this + '&callback=?',
function(json) {
return json.responseData.language;
});
};
Jak mogę zwrócić wartość do osoby dzwoniącej? Dzięki.jQuery getJSON - Wartość zwracana do funkcji dzwoniącego
EDIT: Próbowałem to:
String.prototype.getLanguage = function() {
var returnValue = null;
$.getJSON('http://ajax.googleapis.com/ajax/services/language/detect?v=1.0&q=' + this + '&callback=?',
function(json) {
returnValue = json.responseData.language;
});
return returnValue;
};
Ale to nie działa albo. Zwraca wartość null.
Dzięki, że to świetny pomysł. –