我正在尝试编写一个ajax Web应用程序.我有一个函数,假设请求一个json对象,然后使用它来重新/填充网站.
这是问题中的Javascript (第8 - 16行):
window.onload=LoadData("Home", {});
var _doc = {};
function LoadData(page, params) {
$.get(page, params, function ( data ) {
_doc = jQuery.parseJSON( data );
}
);
document.title = _doc.Title.Title;
};
Run Code Online (Sandbox Code Playgroud)
这是Chrome给出的错误:
Uncaught TypeError: Cannot read property 'Title' of undefined
LoadDatahttp://127.0.0.1/:15
(anonymous function)
Run Code Online (Sandbox Code Playgroud)
如果我在控制台中运行相同的语句,这让我感到困惑:
document.title = _doc.Title.Title;
"Home"
Run Code Online (Sandbox Code Playgroud)
它将标题更改为Home
这是证明其未定义:
_doc
Object
Body: Object
Menus: Array[4]
0: Object
Menu: Object
1: Object
Menu: Object
2: Object
Menu: Object
3: Object …Run Code Online (Sandbox Code Playgroud) 我已经尝试了不少于5种不同的"解决方案",我无法让它工作,请帮助.
这是错误
'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)
Traceback (most recent call last):
File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/__init__.py", line 636, in __call__
handler.post(*groups)
File "/base/data/home/apps/elmovieplace/1.350096827241428223/script/pftv.py", line 114, in post
movie.put()
File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/db/__init__.py", line 984, in put
return datastore.Put(self._entity, config=config)
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py", line 455, in Put
return _GetConnection().async_put(config, entities, extra_hook).get_result()
File "/base/python_runtime/python_lib/versions/1/google/appengine/datastore/datastore_rpc.py", line 1219, in async_put
for pbs in pbsgen:
File "/base/python_runtime/python_lib/versions/1/google/appengine/datastore/datastore_rpc.py", line 1070, in __generate_pb_lists
pb = value_to_pb(value)
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py", line 239, in entity_to_pb
return entity._ToPb() …Run Code Online (Sandbox Code Playgroud) 第一
错误:
ERROR 2011-04-22 23:25:15,513 __init__.py:395] unbound method put() must be called with Movie instance as first argument (got nothing instead)
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\webapp\__init__.py", line 515, in __call__
handler.get(*groups)
File "C:\Users\Jimenez\workspace\elmovieplace\src\script/crawl.py", line 86, in get
getImdbData(year, findPatGamma, findPatGamma2)
File "C:\Users\Jimenez\workspace\elmovieplace\src\script/crawl.py", line 66, in getImdbData
movie.put()
TypeError: unbound method put() must be called with Movie instance as first argument (got nothing instead)
Run Code Online (Sandbox Code Playgroud)
crawl.py:
import wsgiref.handlers
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from urllib2 …Run Code Online (Sandbox Code Playgroud)