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 />
<br /> echo true;<br />