Jump to content

Random name from MySQL database to alertbox (ASP)


lindell

Recommended Posts

Hi, i want to do a function which gets a random name from my MySQL database and then delivers it in a javascript alertbox. If i got this right, i have to use AJAX or something like that, and I REALLY ###### at AJAX, so now i wonder if you can help me with this small function?Sorry for my bad english.Thanks!

Link to comment
Share on other sites

No i'm using ASP. I tried to use Javascript which called for an ASP function, this didn't work.

<!-- #include file="connect.asp" --><%function databas()call baseopen(connect)SQL = "Select namn from namntips order by rand() Limit 1"set recset = connect.execute(SQL)end function%><script type=text/JavaScript><!--function namntips(){<%call databas()%>alert('<%=recset("namn")%>');}//--></SCRIPT><a href="java script: namntips()">Namntips</a>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...