有这样的代码:
$.post("auth.php", {pass : pass}, function(data) {
var x = $(data).find("span#c");
$("div#addform").show();
menu.html(data);
console.log(data);
console.log(x);
alert(x);
和php:
if($ath['mail'] != $pass){ echo "<center> try another pass)</center>";} else {
// print all db
echo("<span id=\"c\">OK</span><br>");
$sql = "SELECT * FROM user";
$result=mysql_query($sql);
响应获取文本/ HTML,但在控制台我得到的只是“[]”和[object Object]如果将alert(x)的所有数据加载到menu.html(data)中为完美的;但为什么我不能得到我的'x'跨度 我做错了什么?
你能告诉我们'data'中有什么吗? – jackwanders