i wrote a code which send a get request by jquery-ajax,also i use a call back to return the result of this request.But the returned value has no applicable method in itself(when i press alt+space i have nothing in that menu).the question is why? any solution?
var result;
var reg = new RegExp(/^.*(youtu.be\/|v\/|e\/|u\/\w+\/|embed\/|v=)([^#\&\?]*).*/);
var split = window.location.href.match(reg);
var videoidxn = split[2];
var url = `https://video.google.com/timedtext?lang=en&v=` + videoidxn;
function GTA(callback) {
var res;
$.ajax({
type: 'Get',
url: url,
success: function(response) {
callback(response)
},
})
}
GTA(function(response) {
result = response;
console.log(result)
})
for example if i want to run the last part of code like this :(add the find method to response)
GTA(function(response) {
result = response.find('text');
console.log(result)
})
i will get the following error: Uncaught Type Error: response.find is not a function