0
混淆我有檢查用戶的一些服務器端腳本:後在阿賈克斯成功函數
function passlog($use,$pass){
$Use = mysql_real_escape_string($use);
$Pass= mysql_real_escape_string($pass);
$res=mysql_query($sql) or die(_ERROR26.":".mysql_error());
$dat=mysql_fetch_array($res,MYSQL_NUM); //it will get result ex. "3"
if(mysql_affected_rows()>0) {
echo $dat[0];
}else{
echo "No specified data";
}
return 0;
}
如果腳本得到結果爲「3」,將返回阿賈克斯成功的功能。然後做下一個工作,如果顯示結果爲「3」,它會發送一些值給另一個變量。
$.ajax({
type:"post",
url:"process3.php",
data:params,
cache:false,
async:false,
success: function(res){
$("#dialog").dialog('close');
var now = new Date();
var months = new Array('01','02','03','04','05','06','07','08','09','10','11','12');
var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();
function fourdigits(number) {
return (number < 1000) ? number + 1900 : number;
}
var today = months[now.getMonth()] + "/" +date+ "/" + (fourdigits(now.getYear()));
switch(parseInt(res)){
case "3":
$("#appdate").text(today); //not work
$("#app").text($("#user").val()); //not work
break;
}
$.ajax({
type:"post",
url:"process1.php",
data:"tversion="+matches+"&action=tunermatches",
cache:false,
async:false,
success: function(res){
$('#tunedat').replaceWith(
"<div id='tunedat'><h6>" + res + "</h6></div>"
);
}
});
},
error:function (xhr, ajaxOptions, thrownError){
alert(xhr.status);
alert(thrownError);
}
});
但是,它不工作,我沒有得到任何錯誤消息。我的阿賈克斯是否錯了?
我在ajax裏也有ajax。
我應該怎麼辦? – nunu 2011-05-19 04:18:13
@nunu查看更新回答 – 2011-05-19 04:18:29
仍然無法正常工作。 '$(「#app」)。text($(「#user」).val())'是將文本字段發送到div的值。 – nunu 2011-05-19 04:21:56