从jquery发布到Google App Engine的表单数据不起作用

时间:2014-05-08 05:48:29

标签: javascript jquery python google-app-engine jquery-mobile

我正在开发一个简单的jquery应用程序,我想要做的是从表单中将usernamename发布到Google App Engine。但是当我点击{{1}时没有任何反应以我的形式。

这是接受数据和提交按钮的表单

addEmpBtn

我的YAML文件看起来像这样

<form id="post" action="http://localhost:8070/addNewEmployee" method="post">
        <input id="username" name="user" placeholder="Username" type="text" size="30"/>
        <input id="name" name="name" placeholder="Name" type="text" size="30"/>
        <a href="#" id="addEmpBtn" data-theme="b" data-role="button" data-inline="true">Register</a>
    </form>

我正在使用application: get-post-test version: 1 runtime: python27 api_version: 1 threadsafe: true handlers: - url: /html static_dir: html - url: /js static_dir: js - url: /png static_dir: imgs - url: /.* script: main.app 编写jQuery-Mobile代码,我的项目目录结构如下所示

enter image description here

最后,这就是Webstorm文件的样子

staff_game.js

由于没有显示任何错误消息,我无法分辨出什么是错误的。我甚至不确定我是否正确配置了URL = "http://localhost:8070/addNewEmployee"; $(document).ready( function() { $("#addEmpBtn").bind('click', function(event){ addNewEmployee(); event.preventDefault(); }); }); function doPostRequest(postData) { $.ajax({ type: "POST", url: URL, data: postData, dataType: "json" }).done(function(data, textStatus, jqXHR){ // This clears out the message sent. $("#username").val(''); $("#name").val(''); setTimeout(doGetRequest, 1000); }).always(function(data, textStatus){ }); } function addNewEmployee() { //Encode the user-id and message as a single JSON // object, in name:value pairs... var struser=$("#username").val(), strmessage=$("#name").val(), postData = {username: struser, name: strmessage}; // Now use this data in a POST operation... doPostRequest(postData); } 文件。 因为当我尝试像

这样的东西时

YAML没有任何反应。但我在某处读到这应该是用javascript(?)返回的东西。 我需要先申报清单吗?如果是这样的话?我做错了什么?

0 个答案:

没有答案