Javascript 如何通过JSON请求HTML文件?
我试图获取一些文件,但其中一种格式是HTML,它应该嵌入到iFrame中。对于这个请求,我使用AJAX和JSON作为数据。有人知道如何调用HTML文件吗?现在它正在调用SWF文件Javascript 如何通过JSON请求HTML文件?,javascript,jquery,html,ajax,json,Javascript,Jquery,Html,Ajax,Json,我试图获取一些文件,但其中一种格式是HTML,它应该嵌入到iFrame中。对于这个请求,我使用AJAX和JSON作为数据。有人知道如何调用HTML文件吗?现在它正在调用SWF文件 if ( 'undefined' === typeof(fsStructure[strPath]) ) { $.ajax({ 'url' : '../php/navigator.php', 'dataType' : 'json',
if ( 'undefined' === typeof(fsStructure[strPath]) ) {
$.ajax({
'url' : '../php/navigator.php',
'dataType' : 'json',
'data' : {'tarFolder':strPath},
success : function( respObj, textStatus, jqXHR ) {
if ( 'undefined' !== typeof(respObj['status']) ) {
if (
('success' === respObj['status']) &&
('undefined' !== typeof(respObj['subfolders'])) &&
('undefined' !== typeof(respObj['subswfs'])) ) {
processNewDFData( respObj, $currentSelectItem, strPath );
} else {
alert( conf.messages.bad_response_format );
}
} else {
alert( conf.messages.bad_response_format );
}
},
error : function( jqXHR, textStatus, errorThrown ) {
alert( conf.messages.failed_ajax_request );
}
});
}
您可以使用jqueryget请求获取html文件
$.get('/yourfile.html', function (data) {
console.log(data);
});
我的代码在数据文件夹中查找,有更多的文件类型swf和html。现在我只能得到swf文件,我也想得到html文件