jQuery的阿贾克斯获得HTTP URL的responseText [英] jquery ajax get responsetext from http url
本文介绍了jQuery的阿贾克斯获得HTTP URL的responseText的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
无论是:
var response = $.ajax({
type: "GET",
url: "http://www.google.de",
async: false,
success : function() {
alert (this);
}
});
也:
var response2 = $.get("http://www.google.de", function(data) {
alert("Data Loaded: " + data);
});
给我一个对象。如何获得访问的responseText
?
推荐答案
您只需必须改写这样的:
You simply must rewrite it like that:
var response = '';
$.ajax({ type: "GET",
url: "http://www.google.de",
async: false,
success : function(text)
{
response = text;
}
});
alert(response);
这篇关于jQuery的阿贾克斯获得HTTP URL的responseText的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文