View Full Version : alert function

11-15-2006, 11:12 PM
Hi guys,

This is kinda hard to explain but I will do my best.

I am trying to create a javascript alert box which only alerts when there is data inside in the alert function. The information I want to display comes dynamically from the database. As such, when data is populated I want the alert to display. When there is no data in the alert function I dont want any alert box appearing. The way it works is the data comes in dynamicly through a placeholder @data@ I put in the javascript. Depending on the actions of the user this will populate with data or nothing at all. Below is an example of just a standad Alert with my plaeholder.

Is there anyway I can do this? Any help would be greatly appreciated.


// Javascript Alert with placeholder

alert ("@data@")

11-15-2006, 11:26 PM
how about a function

function myalert(iVal){
if (iVal) alert(iVal);

11-16-2006, 09:19 AM
I think your overall strategy is wrong. Have the server side database code create the function if it's needed. If it isn't, then don't have it there... it just messes things up.
You could use comments, perhaps, if that would help...
//function(), but doesn't go, 'cause of comments
Just put // to disable a line, at the beginning of the line, with the server side code.
But, again, just don't create the function in the first place.

the above could help as well.