发送按钮单击时没有任何反应 [英] Nothing happen when send button click

查看:64
本文介绍了发送按钮单击时没有任何反应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<html>
<head>
<title>
Daily Trip Logsheet
</title>
</head>

<body>

<p> Please Put Details </p>

Dry Run: <input id="DryRun" type="text" placeholder="in Km">
<button id="ButtonSubmit" onclick="postContactToGoogle()" type="button">Post</button>

<script>
	function postContactToGoogle(){
		var dryrun = $('#DryRun').val();
		
			$.ajax({
			url: "https://docs.google.com/forms/d/1iHuOmQx0hXKH6DGb2GNUc-yu-0Iiv9PDkKPgAXX3Ldc/formResponse",
			data:{
			"entry_1438934548"
			}
			type: "POST",
			dataType: "xml",
			statusCode: {
			0:function () {window.location.replace("ThankYou.html");},
            200: function () {window.location.replace("ThankYou.html");}
			}
			});
		}
</script>

<script src="http://code.jquery.com/jquery-1.11.0.js"></script>
<script type="text/javascript"></script>


</body>
</html>







SHOUTING已删除 - OriginalGriff [/ edit]




[edit]SHOUTING removed - OriginalGriff[/edit]

推荐答案

' #DryRun')。val();
('#DryRun').val();


.ajax({
url: https:// docs .google.com / forms / d / 1iHuOmQx0hXKH6DGb2GNUc-yu-0Iiv9PDkKPgAXX3Ldc / formResponse
data:{
entry_1438934548
}
类型: POST
dataType: xml
statusCode:{
0 function (){ window location .replace( ThankYou.html);},
200 function (){ window location .replace( ThankYou.html);}
}
});
}
< / 脚本 >

< script src = http://code.jquery.com/jquery-1.11.0.js > < / script < span class =code-keyword>>

< script type = text / javascript > < / script >


< / body >
< / html >
.ajax({ url: "https://docs.google.com/forms/d/1iHuOmQx0hXKH6DGb2GNUc-yu-0Iiv9PDkKPgAXX3Ldc/formResponse", data:{ "entry_1438934548" } type: "POST", dataType: "xml", statusCode: { 0:function () {window.location.replace("ThankYou.html");}, 200: function () {window.location.replace("ThankYou.html");} } }); } </script> <script src="http://code.jquery.com/jquery-1.11.0.js"></script> <script type="text/javascript"></script> </body> </html>







SHOUTING已删除 - OriginalGriff [/ edit]




[edit]SHOUTING removed - OriginalGriff[/edit]


代码中的这个不是很简单吗? jQuery是一个基于JavaScript的库,而不是内置函数。您需要首先确保现在运行jQuery,您需要处理document.ready函数,然后在那里触发jQuery代码。您已经有效地将代码写入包含库,但不是运行库。编辑你的代码,并用这种方式编写,



Isn't that pretty much simple in your code? jQuery is a library over JavaScript, not a built-in function. You need to first make sure that now jQuery is going to run, you need to handle the document.ready function and then trigger the jQuery code there. You've efficiently written the code to include the library, but not run the library. Edit your code, and write it this way,

function postContactToGoogle(){
     // jQuery runs under this event


这篇关于发送按钮单击时没有任何反应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆