使用ajax在Google应用引擎中自动填充文本框

时间:2022-08-18 19:37:56

Hello i am working with ajax in goolge app engine, i am trying to make autocomplete textbox.

您好我正在goolge应用程序引擎中使用ajax,我正在尝试制作自动填充文本框。

    HTML CODE
    <input id="search_form">

    Ajax function is ,
    $('#search_form').autocomplete(/search)

    And class search is,

    class search(webapp2.RequestHandler):
    def get(self):
        data = ['A','B','C', 'D']
        data = json.dumps(data)         
        self.response.out.write(data)

I am not familier about ajax , whats wrong with this code ? Is any thing is wrong with this code ?

我对ajax并不熟悉,这段代码有什么问题?这段代码有什么问题吗?

1 个解决方案

#1


0  

I think you need to

我想你需要

def get(self):
  data = ['A','B','C', 'D']
  data = json.dumps(data)         
  self.response.headers.add_header('content-type', 'application/json', charset='utf-8')
  return self.response.out.write(data)

#1


0  

I think you need to

我想你需要

def get(self):
  data = ['A','B','C', 'D']
  data = json.dumps(data)         
  self.response.headers.add_header('content-type', 'application/json', charset='utf-8')
  return self.response.out.write(data)