Trang Chủ | Diễn Đàn | Thành Viên (Đăng Ký) | Tìm Kiếm | Tutorial Room
HTML & JavaScript - AJAX và một số kỹ thuật liên quan.
First page Previous page  (Page 2 )   1     2   Next page Last page
Re: II. Chèn thêm Script
Member
Member since
21:02 31-07-2007
Posts: 1
Fantasy Points: 4
Rank
shocked Posted at 23:28 31-07-2007 Move Move Topic   Pin/Unpin Pin Topic   Lock Lock Topic
Reply to II. Chèn thêm Script (Sacroyant)
Sao tui làm theo như bác chỉ mà sao no chạy không được, con phần trên (dung iframe làm bộ đệm thì chạy OK).Phần kiểm tra user thì không chịu chạy hok hiểu tại sao lun.Mong bác chỉ giúp
Reply Reply   Quote Quote   Edit Edit   Delete Delete   Report Report
This post has been viewed 17,946 time(s). 1 direct repli(es) and 4 indirect repli(es).
Title Poster
shocked Re: II. Chèn thêm Script
 
answer Re: II. Chèn thêm Script
Sacroyant
Re: II. Chèn thêm Script
Forum Moderator
Member since
20:09 22-08-2005
Posts: 691
Fantasy Points: 6,726
Rank
answer Posted at 06:56 01-08-2007
Reply to Re: II. Chèn thêm Script (minh_bentre)
minh_bentre:
Sao tui làm theo như bác chỉ mà sao no chạy không được, con phần trên (dung iframe làm bộ đệm thì chạy OK).Phần kiểm tra user thì không chịu chạy hok hiểu tại sao lun.Mong bác chỉ giúp


Bác kiểm tra lại xem sao. Hoặc cho tôi xem code của bác, chắc có chỗ nào chưa chính xác đấy.
-------------------------------

http://sacroyant.uni.cc
Reply Reply   Quote Quote   Edit Edit   Delete Delete   Report Report
This post has been viewed 17,916 time(s). 1 direct repli(es) and 3 indirect repli(es).
Title Poster
answer Re: II. Chèn thêm Script
 
question Cho hỏi về loading trên web bằng AJax
phonui
Cho hỏi về loading trên web bằng AJax
Member
Member since
08:08 25-10-2007
Posts: 11
Fantasy Points: 39
Rank
question Posted at 02:12 27-10-2007
Reply to Re: II. Chèn thêm Script (Sacroyant)
Đoạn code này viết theo kỹ thuật AJAX cho nút "Xem" trên web của mình (nút này khi nhấp vào sẽ load 1 file tương ứng từ database).
<asp:TemplateColumn HeaderText="<b>Xem</b>" ItemStyle-Width="50px" ItemStyle-HorizontalAlign="Left">
<ItemTemplate> <asp:HyperLink ID="lnkView" runat="server" Target="_self" NavigateUrl="../pages/#"></asp:HyperLink></ItemTemplate>
</asp:TemplateColumn>

Sao mình view source trang web thấy ghi địa chỉ: 192.168.1.2/<abc.pdf> nên chỉ có máy trong mạng ảo của mình đọc được file đó. Các máy bên ngoài thì ko đọc được.(Trang web mình đã hosting và truy cập được nhưng ko đọc được file đính kèm)
MÌnh phải sửa ở chỗ nào? AJax mình cũng mới tập làm thôi. Mong sự giúp đỡ của bạn. Cám ơn nhiều.
Reply Reply   Quote Quote   Edit Edit   Delete Delete   Report Report
This post has been viewed 16,085 time(s). 1 direct repli(es) and 2 indirect repli(es).
Title Poster
question Cho hỏi về loading trên web bằng AJax
 
question Re: Cho hỏi về loading trên web bằng AJax
muitennhon
Re: Cho hỏi về loading trên web bằng AJax
Member
Member since
00:07 22-08-2007
Posts: 16
Fantasy Points: 62
Rank
question Posted at 23:43 29-11-2007
Reply to Cho hỏi về loading trên web bằng AJax (phonui)
Mình cũng làm như bạn dùng Iframe thì ok. nhưng làm cách xml thì không được , cho mình hỏi là ở trang xml.php code đầy đủ là như trên hay phải thêm gì không? (trang cũ nó có <html>.. .<body>.<area>...)vậy mình có giữ nguyên không hay bỏ đi.
Ở trang client thì ngoài đoạn script ra có cần thêm code gì không?
bạn nào có thể port đầy đủ code của 2 trang đó lên không?
Thankss
Reply Reply   Quote Quote   Edit Edit   Delete Delete   Report Report
This post has been viewed 15,461 time(s). 1 direct repli(es) and 1 indirect repli(es).
Title Poster
question Re: Cho hỏi về loading trên web bằng AJax
 
answer Re: Cho hỏi về loading trên web bằng AJax
Sacroyant
Re: Cho hỏi về loading trên web bằng AJax
Forum Moderator
Member since
20:09 22-08-2005
Posts: 691
Fantasy Points: 6,726
Rank
answer Posted at 09:55 30-11-2007
Reply to Re: Cho hỏi về loading trên web bằng AJax (muitennhon)
Bạn cứ làm như trong bài viết tham khảo là được. Nếu nó không cho ra kết quả mong muốn, thì có thể lỗi ở đâu đó khi bạn viết mã. Thử đưa đoạn code của bạn lên đây được không ?
-------------------------------

http://sacroyant.uni.cc
Reply Reply   Quote Quote   Edit Edit   Delete Delete   Report Report
This post has been viewed 15,427 time(s). 1 direct repli(es) and 0 indirect repli(es).
Title Poster
answer Re: Cho hỏi về loading trên web bằng AJax
 
answer Re: Cho hỏi về loading trên web bằng AJax
muitennhon
Re: Cho hỏi về loading trên web bằng AJax
Member
Member since
00:07 22-08-2007
Posts: 16
Fantasy Points: 62
Rank
answer Posted at 23:06 30-11-2007
Reply to Re: Cho hỏi về loading trên web bằng AJax (Sacroyant)
code đây:
trang load.php
<?
header("Cache-Control: no-cache, must-revalidate");
header("Content-type: text/xml");

// Tạo 2 giá trị mặc định cho 2 node Title và Story.

$title="No data here";
$story="";

$id=trim($_GET['id']);

$sql="Select * FROM tblNews WHERE NewsID='".addslashes($id)."'";

// kết nối cơ sở dữ liệu MySQL từ localhostt, với username là root, password rỗng :

@$conn = mysql_connect("localhost","root","");
if(!$conn){
die('Could not connect database in this time ! ');
exit();
}

// Mở cơ sở dữ liệu có tên News để làm việc

mysql_select_db("News", $conn);

// thực hiện truy vấn SQL, trả kết quả vào biến $result :

$result=mysql_query($sql);

// Nếu có mẩu tin nào đó :

if(mysql_num_rows($result)>0){

// xem xét nội dung truy vấn ở dạng array :

$row=mysql_fetch_array($result);

// Gán lại nội dung của các phần tử mảng $row cho $title, và $story :

$title=$row['Title'];
$story=$row['Story'];

}

mysql_free_result($result);
mysql_close($conn);

// trình bày theo đúng định dạng XML

echo'<?xml version="1.0" encoding="UTF-8"?>';
?>
<SNNews>
<title><?=htmlspecialchars($title)?></title>
<story><?=htmlspecialchars($story)?></story>
</SNNews>

code trang index.php

<script type="text/javascript">

function rel(ob){return document.getElementById(ob);}
function gTxt(ob,txt){rel(ob).innerHTML=txt;}

function loadNews(id){
var data=null, url="xml.php?id="+id;
if(document.implementation&&document.implementation.createDocument){
data=document.implementation.createDocument("","",null);
data.load(url);
data.onload=function (){parseXML(data);}
}
else if(window.ActiveXObject){
data=new ActiveXObject("Microsoft.XMLDOM");
data.async=true;
data.load(url);
data.onreadystatechange=function (){
if(data.readyState==4){
parseXML(data);
}
}
}
else{
alert("Sorry, your web browser is not yet supported.");
return;
}
}

function parseXML(data){
var root=data.getElementsByTagName("SNNews");
var title=root[0].getElementsByTagName("title")[0].firstChild.nodeValue;
var story=root[0].getElementsByTagName("story")[0].firstChild.nodeValue;
var s="<h4>"+title+"</h4>"+story;
gTxt('news',s);
}
</script>

//////////////////

mình thấy thiếu thiếu cái gì đó, nhưng chưa biết chỉnh ở đâu. bạn nào biết chỉ mình với . thanks
Reply Reply   Quote Quote   Edit Edit   Delete Delete   Report Report
This post has been viewed 15,414 time(s). 0 direct repli(es) and 0 indirect repli(es).
First page Previous page  (Page 2 )   1     2   Next page Last page

Permissions: Create Topic: No  |  Reply Topic: No  |  Attach File: No  |  Make Poll: No

Vietnamese Keyboard: AUTO TELEX VNI VIQR VIQR* OFF

Go top || Print page ||

All logos, trademarks and graphics artwork in this site are property of their respective owners.
Opinions expressed in articles within this site are those of their owners and may not reflect the opinion of TXBB.

TXBB: Home - Disclaimer - Help - Contact
Copyright (C) 2000-2006 TXBB. All rights reserved.

TreXanh Bulletin Board v2.0 (Build: #332 Nov 21, 2006)

DEBUG INFORMATION
Execution 0.162s - SQL used 3s - Concurrent process(es) 0