Jim Lawrence
accessd at shaw.ca
Fri May 11 08:54:42 CDT 2007
Hi Marty:
Thanks for all that information. I will check it out and get back to you.
Forgot to mention that the actual working page in an iframe.
If anyone is interested, below is a listing of how to use basic AJAX.
Here is a program over-view: When an item on the list is selected the
JavaScript AJAX is called (function DisplayList). The JavaScript call (AJAX
part) calls a server side ASP file that gets the data and returns the data
to the now waiting AJAX function. The JS functions insert the data in a
panel, turns the panel display mode on and sets the focus to the new panel.
The JavaScript functions that do all the data and screen management:
// variable are initialized on web page call
var xmlHttp
var pcode
var position
function DisplayList(pcode, position)
{
// Test for compatible browsers
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
// Point to the server side ASP applet
var url="http://online.creativesystemdesigns.com/projects/programming3.asp";
url=url+"?pcode="+pcode;
url=url+"&position="+position;
// Now wait for a state change... data ready?
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
// Supposed to set data retrieved to UTF-8 ... does not :-(
xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded;
charset=UTF-8');
xmlHttp.send(null);
}
function stateChanged()
{
// If state = 4 data returned.
if (xmlHttp.readyState==4)
{
// Get the returning data and push it into the panel
document.getElementById("ProductList").innerHTML=xmlHttp.responseText;
}
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari and every other browser
// except IE
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer browsers have a couple of option
// and the latest release are going comply then there
// 3 options for IE.
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
function CloseList(ref, code)
{
// Toggles off or on a screen object. This object is
// z-indexed (greater than 1 which is the default)
// so it floats above the other objects on screen.
var reference = document.getElementById(ref);
var box = document.getElementById('localbox');
if (reference.style.display =='none')
{
DisplayList(code, 1);
reference.style.display ='';
} else {
reference.style.display ='none';
}
}
Thanks again Marty
Jim
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of MartyConnelly
Sent: Thursday, May 10, 2007 5:12 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] OT AJAX question
I can't see the code for the ASP page as an example
"http://online.creativesystemdesigns.com/projects/programming3.asp?pcode=1,&
position=1"
So as far as I understand, one way is to encode your ASP
documents as UTF-8 and indicate the encoding as the code page (UTF-8 is
code page 65001 e.g. There are probably are other methods.
Something like this
<%@ Language="VBScript" CodePage="65001" %>
<%
Response.ContentType = "text/plain; charset=UTF-8"
For Each Key In Request.Form
Response.Write Key & "=" & Request.Form(Key) & VbCrLf
Next
Response.Write "Original request data: " & Request.Form & VbCrLf
%>
or maybe something like
Response.ContentType = "text/xml"
Response.CharSet = "UTF-8"
oOutputDOM.save Response
That way ASP will properly decode the data send as
application/x-www-form-urlencoded; charset=UTF-8 automatically, there
Jim Lawrence wrote:
>Hi Marty:
>
>I do understand your comments about UTF encoding but I have not been able
to
>resolve the issue even though, on the surface, it would seem to be simple.
>
>See the following site, page and app sample and this will demonstrate the
>issue that I am having and maybe the code will suggest a solution. It
should
>be straight-forward but I have just missed some small point:
>http://online.creativesystemdesigns.com/projects/programming.asp
>
>TIA
>Jim
>
>-----Original Message-----
>From: accessd-bounces at databaseadvisors.com
>[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of MartyConnelly
>Sent: Thursday, May 10, 2007 1:18 PM
>To: Access Developers discussion and problem solving
>Subject: Re: [AccessD] OT AJAX question
>
>I would have to see the Javascript that is doing this
>
>Generally this would be set in the encoding parameter of the XML
>PI Processing instruction, there are about 30 of these some dependant
>on the Windows codepage. SQL Server or Access punts it out in UTF-8 even
>without
>including a PI. There are ways to transliterate between encodings using ADO
>streams. It can also be determined by the BOM marker at the start of
>the file.
>
>In your case for Unicode encoding, you would want something like
>this XML PI
>
><?xml version="1.0" encoding="UTF-8"?>
>
>http://www.geocities.com/pmpg98_pt/CharacterEncoding.html
>http://support.microsoft.com/kb/q275883/
>
>
>XML Encodings
>
>MSXML supports all encodings that are supported by Microsoft Internet
>Explorer.
>Internet Explorer's support depends on which language packs are installed
>on the computer; this information is stored under the following registry
>key:
>HKEY_CLASSES_ROOT\MIME\Database\Charset
>
>xml example
>
><?xml version="1.0" encoding="ISO-8859-1"?>
><character>
> <chr>í</chr>
></character>
><!-- ISO-8859-1 encoded (Windows Code Page 1252?) -->
><!-- It must have the correct encoding declaration -->
><!-- The special char will display correctly on system that suport that
>codepage -->
>
>Jim Lawrence wrote:
>
>
>
>>OT AJAX
>>
>>Hi all:
>>
>>This question is totally off-topic but the list members here have an
>>incredible berth and depth of knowledge and I am sure someone will know or
>>know where to look.
>>
>>For anyone here that has worked with AJAX/XML by default the information
>>coming back from the server only supports 128 bit ASCII. That is great for
>>straight English but any other single byte language, 256 bits is a
minimum.
>>
>>Has anyone ran across a solution or knows where to find a solution? If so
>>many thanks is advance. (...have researched a number of potential
solutions
>>but have been unable to either get them to work or have them fall-over
with
>>one client or another.)
>>
>>Jim
>>
>>
>>
>>
>>
>
>
>
--
Marty Connelly
Victoria, B.C.
Canada
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com