Posted on 2007-11-16
Last Modified: 2012-08-14
I need help from someone who realy understands how the ajaxed work

when i add some code(under or above) to the basic code that you can see there,
i got a strange error inside browser alert that say
"root": "{null}"
and after those 2 words i got the 'code that i added'

that is the code that alerting
xxxxxx { "root" : {null}
*without the xxxxxx the code works just fine...
i tried to add the xxxxxx between asp line with response.write it gave me the same error
and when i put the xxxxxx at the end of the code there was no error but the code not worked at all(without errors)

<!--#include file="ajaxed.asp"-->



dim sse, mysqlj, connTempj, connstring, rstempj


Set connTempj = Server.CreateObject("ADODB.Connection")

set rstempj = server.createObject("adodb.recordset")

ConnString = myconnectionstring                       

connTempj.Open ConnString

mySQLj="SELECT alert,time FROM crmalerts WHERE time=(SELECT Max(time) FROM crmalerts)" mySQLj, connTempj  



set page = new AjaxedPage


sub init() : end sub 

sub callback(action) 

if not rstempj.EOF and action = "poll" and session("alertime")<>ptime then



end if

end sub 

function poll()  

  poll = "<p style='background:#828282;color:#000000;font-size:20px;'>" & palert & ptime & "</p>"

end function

sub main() 



var tId=""; // create global variable to hold the interval handler 

function pollDB() {

 /* call the server and when return, call the javascript function showResult with the result */   

ajaxed.callback('poll', showResult);



function showResult(result) {    

$('res').style.display = 'block';

$('data').innerHTML = result; // put the result into the div with id="res"


// onLoad (or set the same in the page load asp thingy ) 

window.onload=function() { tId=setInterval('pollDB()',6000); 



<div id="res" style="cursor:progress;background:#828282;border:1px solid;position:absolute;left:210px;width:200px; top:290px;display:none">

<div id="data" style="float:left;width:100%"></div>

<div style="float:right" onclick="$('res').style.display = 'none'">X</div>


<% end sub %>

Open in new window

Question by:sasha85
  • 4

Author Comment

ID: 20302723
i found the function that give this alert but don't realy understood it well...
the function called 'public sub draw()'
that is the code of all the functions
LVL 82

Accepted Solution

hielo earned 500 total points
ID: 20303311
It seems that for some reason the buffer is not fully flushed. In ajaxedpage.asp, locate:
sub draw()
and modify the "if" clause immediately after init() with the following:
            if isCallback() then
                  writeln("{ ""root"": {")
                  status = 0
                  callback(left(RF(callbackFlagName), 255))
                  if status = 0 then write(" null ")
                  if status = 1 then
                        writeln(vbcrlf & "} }")
                        writeln(vbcrlf & "}")
                  end if


Author Comment

ID: 20303687
to update?
i tried to delete all this
but when i do this it still gives me the browser alert...but this time the lert is empty...
empty alert with ok button

if isCallback() then

			writeln("{ ""root"": {")

			status = 0

			callback(left(RF(callbackFlagName), 255))

			if status = 0 then write(" null ")

			if status = 1 then

				writeln(vbcrlf & "} }")


				writeln(vbcrlf & "}")

			end if


			if loadPrototypeJS then loadJSFile(loc("prototype.js"))



				"ajaxed.prototype.debug = " & iif(debug, "true", "false") & ";",_

				"ajaxed.prototype.indicator.innerHTML = '" & loadingText & "';"_



		end if

Open in new window


Author Comment

ID: 20303690
i'm not sure but i think it got something to do with
private sub setHTTPHeader

Author Comment

ID: 20303722
GOD! i misread your post...
hielo!!!!!!! it is working!!!!!!!
thank you!!!

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL ( several years ago, it seemed like now was a good time to updat…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now