Home > Backend Development > PHP Tutorial > ajax接受不到回来的信息

ajax接受不到回来的信息

WBOY
Release: 2016-06-13 12:56:31
Original
732 people have browsed it

ajax接受不到返回的信息
a.html:

<br />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br />
<html xmlns="http://www.w3.org/1999/xhtml"><br />
<head><br />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><br />
<title>无标题文档</title><br />
<script language='javascript' type='text/javascript' src="js/ajax.js"></script><br />
<script language='javascript' type='text/javascript' src="js/jquery.js"></script><br />
<script type="text/javascript"><br />
function check()<br />
{<br />
	var con = document.getElementById('con').value;<br />
	//alert(con);<br />
	<br />
	//创建ajax<br />
	var ajax = createAjax();<br />
	//是否创建成功<br />
	//alert (ajax);<br />
	var data = new Date();<br />
	<br />
	var urlStr = 'b.php?action='+data.getTime();<br />
	//alert(urlStr);<br />
	$.ajax({<br />
		url:urlStr,<br />
		datatype: "json", <br />
		cache: false,<br />
		success:function(response){<br />
			alert(response);<br />
		}<br />
	});	<br />
}<br />
</script><br />
</head><br />
<br />
<body><br />
<form action='' method='post' enctype="application/x-www-form-urlencoded"><br />
<input type='text' name='con' id='con' value='' /><br />
<input type='submit' name='sub' value='提交' onclick='check()'/><br />
</form><br />
</body><br />
</html><br />
Copy after login


b.php:
<br />
echo true;<br />
Copy after login


ajax接受不到b.php返回的信息,请问错在哪里,谢谢


------解决方案--------------------
你点击按钮之后不会跳转吗
------解决方案--------------------
button' name='sub' value='提交' onclick='check()'/>
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template