Solved

AJAXED ASP

Posted on 2007-11-16
5
495 Views
Last Modified: 2012-08-14
http://www.webdevbros.net/ajaxed/
I need help from someone who realy understands how the ajaxed work
http://www.webdevbros.net/2007/07/02/ajaxed-calling-server-side-vbscript-procedures-from-client-side-equivalent-to-php-xajax/
http://www.webdevbros.net/2007/07/02/ajaxed-calling-server-side-vbscript-procedures-from-client-side-equivalent-to-php-xajax/ 

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"-->
xxxxxx
<%
 
dim sse, mysqlj, connTempj, connstring, rstempj
sse=session("alerti")
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)"
 
 
 
rstempj.open mySQLj, connTempj  
 
 
palert=rstempj("alert")
ptime=rstempj("time")
 
 
 
 
 
 
set page = new AjaxedPage
page.draw() 
sub init() : end sub 
 
 
sub callback(action) 
if not rstempj.EOF and action = "poll" and session("alertime")<>ptime then
session("alertime")=ptime
page.return(poll())
end if
end sub 
 
 
 
function poll()  
  poll = "<p style='background:#828282;color:#000000;font-size:20px;'>" & palert & ptime & "</p>"
end function
 
 
 
 
 
sub main() 
%> 
<script>  
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); 
}
 
</script> 
 
 
<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>
</div>
 
 
<% end sub %>

Open in new window

0
Comment
Question by:sasha85
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 

Author Comment

by:sasha85
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
http://ilmc.brinkster.net/comersus/crm/ajax/ajaxedPage.txt
0
 
LVL 82

Accepted Solution

by:
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
                  response.clear()
                  writeln("{ ""root"": {")
                  status = 0
                  callback(left(RF(callbackFlagName), 255))
                  if status = 0 then write(" null ")
                  if status = 1 then
                        writeln(vbcrlf & "} }")
                  else
                        writeln(vbcrlf & "}")
                  end if
                  response.flush()
                  response.end()
            else

0
 

Author Comment

by:sasha85
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 & "} }")
			else
				writeln(vbcrlf & "}")
			end if
		else
			if loadPrototypeJS then loadJSFile(loc("prototype.js"))
			loadJSFile(loc("ajaxed.js"))
			execJS(array(_
				"ajaxed.prototype.debug = " & iif(debug, "true", "false") & ";",_
				"ajaxed.prototype.indicator.innerHTML = '" & loadingText & "';"_
			))
			main()
		end if

Open in new window

0
 

Author Comment

by:sasha85
ID: 20303690
i'm not sure but i think it got something to do with
private sub setHTTPHeader
http://ilmc.brinkster.net/comersus/crm/ajax/ajaxedPage.txt
0
 

Author Comment

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

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Slush on text 2 22
What kind of script/language created this graph? 6 58
Woo-commerce gallery not working properly 12 34
Json and ajax javascript 24 21
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article discusses how to implement server side field validation and display customized error messages to the client.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

738 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