Form viết bài bằng ajax (mệt chổ capcha) ? 2007-11-01 10:36:55
Form viết bài của mình dạng như sau:
<div id=content>nội dung trả về sẽ hiện thị ở đây</div>
<div id=img>hình biểu tượng ajax</div>
<form>
form viết bài ở đây
<input> nhập mã xác nhận
Dạng như vậy, vấn đề post bài thì ok, còn không biết làm sao để đổi cái hình mã xác nhận hết, vì dữ liệu trả về nằm ở <div id=content> mất tiêu rồi
<div id=content>nội dung trả về sẽ hiện thị ở đây</div>
<div id=img>hình biểu tượng ajax</div>
<form>
form viết bài ở đây
<input> nhập mã xác nhận
Dạng như vậy, vấn đề post bài thì ok, còn không biết làm sao để đổi cái hình mã xác nhận hết, vì dữ liệu trả về nằm ở <div id=content> mất tiêu rồi
Tra loi 13 comment(s) 2007-11-01 10:36:55
TG 2007-11-01 10:58:27
Tra loi
changtraingheo 2007-11-02 02:28:35
Tra loi
TG 2007-11-02 05:42:00
Tra loi
changtraingheo 2007-11-03 03:28:07
document.getElementById(idImg).innerHTML = img;
if (http_request.readyState == 4) {
if (http_request.status == 200) {
//alert(http_request.responseText);
var result = http_request.responseText;
document.getElementById(idImg).innerHTML = '';
document.getElementById(idContentCenter).innerHTML = result;
} else {
alert('There was a problem with the request.');
}
}
}
(còn một hàm nữa là makePOSTAddRequest nhưng dữ liệu trả về ở hàm AlertAdd nên ko post)
ở chổ document.getElementById(idContentCenter).innerHTML = result; mình sửa lại thành
document.getElementById(idContentCenter).innerHTML = eval(result);
nhưng nếu ghi kiểu zday thì ứng dụng bị lỗi, nên cũng chẳng biết sao hết
Tra loi
TG 2007-11-03 08:02:51
Tra loi
changtraingheo 2007-11-03 12:13:22
if(document.getElementById){var x=(window.ActiveXObject)?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();}
if(x){x.onreadystatechange=function() {
el=document.getElementById(id);
el.innerHTML='loading....';
if(x.readyState==4&&x.status==200){
el.innerHTML='';
el=document.getElementById(id);
el.innerHTML=x.responseText;
eval(eval_str);
}
}
x.open("GET",url,true);x.send(null);
}
}
</script>
<div id="hienthi" style="border: 1px solid #ccc;"> </div>
<a href="#" onclick="$('file_noidung.php','hienthi');">Demo</a>
</html>
cũng xem qua code của TG rồi, nhưng ko hiểu một chổ, toàn bộ code ko có liên quan tới biến eval_str, zday trong hàm ở chổ eval(eval_str) đâu có tác dụng đâu
Tra loi
me at ducthuan dot info 2007-11-03 12:26:41
<response>
<mainContain>Dữ liệu đổ vào container</mainContain>
<captcha>Thông tin về captcha</captcha>
</response>
Tra loi
changtraingheo 2007-11-06 09:10:51
Tra loi
TG 2007-11-06 09:37:01
Tra loi
Quốc Hưng 2009-12-17 12:32:22
Khi reload captcha bằng ajax thì xử lý thay dữ liệu hình captcha như sau là ok
document.getElementById(idImg).src='filephp_captcha.php';
Tra loi
choncon 2009-12-18 09:28:23
document.getElementById(idImg).src='filephp_captcha.php?'+ (new Date);
Tra loi
choncon 2009-12-18 02:00:24
to su bon cau thu VietNam , da dam nhu cai cuc shit
Tra loi
Tống Kiện Phi 2009-12-19 02:17:19
Tra loi
Y kien