Heim  >  Artikel  >  Backend-Entwicklung  >  ajax接受不到回来的信息

ajax接受不到回来的信息

WBOY
WBOYOriginal
2016-06-13 11:11:05837Durchsuche

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 />


b.php:
<br />echo true;<br />


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


------解决方案--------------------
你点击按钮之后不会跳转吗
------解决方案--------------------
button' name='sub' value='提交' onclick='check()'/>
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn