No, i doesn't work, msgtime is still "msgtime=16%3A22%3A08".
On Oct 21, 8:23 am, "Saiful Amri" <[EMAIL PROTECTED]> wrote:
> Dear...
> try using
> ....&msgtime="+encodeURIComponent(msgtime)
>
> I think it does work, thanks
>
> Saiful Amri
>
>
>
> On Tue, Oct 21, 2008 at 1:12 AM, Uzm <[EMAIL PROTECTED]> wrote:
>
> > I've a small problem with new Ajax.Request. Actually, there isn't
> > really a problem with the function itself, but with encoding.
> > Here is my code:
>
> > function getData() {
> > new Ajax.Request('chat.php', { method: 'post', encoding:
> > 'windows-1251', parameters: "userId=" + userId + "&msgtime=" +
> > msgtime,
> > onComplete: function(getDataRequest) {
> > if (getDataRequest.responseText.substr(0,1) == "|") {
> > clearTimeout(yo);
>
> > alert(getDataRequest.responseText.substr(1,getDataRequest.responseText.leng-th
> > - 1));
> > exit();
> > }
> > else {
> > var lines = getDataRequest.responseText.split('\n');
> > lines.length = lines.length - 1;
> > if (lines.length > 0) {
> > onlineUserList = lines[0].split("|");
> > onlineUserList.length = onlineUserList.length - 1;
> > }
> > if (lines.length > 1) {
> > for (i = 1; i < lines.length; i++) {
> > var msg = lines[i].split("|");
> > try {
> > parent.talk.printmsg(msg[0],msg[1],msg[2],msg[3]);
> > } catch (e) {
> > }
> > msgtime = msg[4];
> > }
> > }
> > seichas = document.getElementById("chatlan");
> > mysp = document.createElement("span");
> > hrprfr = document.createTextNode("ЮЗЕРОВ ОНЛАЙН: " +
> > onlineUserList.length);
> > mysp.appendChild(hrprfr);
> > seichas.replaceChild(hrprfr, seichas.firstChild);
> > parent.menu.printmenu();
> > }
> > yo = setTimeout('getData()', chatTimeout);
> > },
> > onFailure: function(transport) {
> > alert('XHR failed!\nReason:' + transport.responseText)
> > } } );
> > }
>
> > The problem is in:
> > "&msgtime=" + msgtime
> > Msgtime is selected from the database before it is sent. In the table,
> > Msgtime type is "TIME", which shows current time in H:i:s (hours,
> > minutes, seconds).
>
> > I've debugged the request with "SoftX HTTP Debugger", and here's the
> > request:
>
> > POST /chat.php HTTP/1.1
> > Accept: text/javascript, text/html, application/xml, text/xml, */*
> > Accept-Language: sv
> > x-prototype-version: 1.6.0.3
> > Referer:http://www.talk.ee/
> > x-requested-with <http://www.talk.ee/x-requested-with>: XMLHttpRequest
> > Content-Type: application/x-www-form-urlencoded; charset=windows-1251
> > UA-CPU: x86
> > Accept-Encoding: gzip, deflate
> > User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET
> > CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; InfoPath.
> > 1; .NET CLR 1.1.4322)
> > Host:www.talk.ee
> > Content-Length: 29
> > Connection: Keep-Alive
> > Cache-Control: no-cache
> > Cookie: N=Uzm; PHPSESSID=8a8ebf98310cf9ed6f3ea0e8091a1904
>
> > userId=1&msgtime=21%3A09%3A48
>
> > As you can see, msgtime is "21%3A09%3A48", althought it should be
> > "21:09:48".
> > I've triend with encodeURIcomponent(), but it doesn't seem to work.
>
> > Could you guys help me out with this one?
> > Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---