在Google App Engine中使用jQuery.Ajax获取404错误

时间:2011-04-30 17:18:47

标签: google-app-engine jquery

在我的google apps引擎应用程序中,我正在尝试使用jquery.Ajax从XML文件中获取数据,但是当我运行该页面时,它会返回XML文件的404错误。 XML文件位于应用程序的根文件夹中,即与索引页面处于同一级别。

我有一个索引页面,在索引页面中,我有以下代码(在脚本标记内)

$(document).ready(function(){
  $.ajax({
    type: "GET",
    url: "states.xml",
    dataType: "xml",
    error:function(xhr,err){
       alert("readyState: "+xhr.readyState+"\nstatus: "+xhr.status);
       alert("responseText: "+xhr.responseText);
    },              
    success: function(xml) {
       alert("success");
    }
  });
 });  

1 个答案:

答案 0 :(得分:2)

您的app.yaml中是否定义了静态文件处理程序?如果您所做的就是将XML文件放在应用程序根目录中,它将无法自动路由。

http://code.google.com/appengine/docs/python/config/appconfig.html#Static_File_Handlers