Jump to content
  • Advertisement
Sign in to follow this  
lack o comments

[web] Calling server-side scripts with HTML events

This topic is 4527 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I recently obtained a new host that supports server-side scripts and was busy re-writing my site when I slammed into a wall. It seems that functions contained in server-side scripts cannot be called from HTML tag events, ones such as "onclick". The basic idea was that upon clicking a link, a function in a server-script would set a few server-variables to be used after redirecting to another page. I don't want to pass the data in the query string, nor use cookies along with client-scripts. And at the time I am completely unfamiliar with any databasing. So, is there any other alternative I can use? I'm using ASP and JScript/javascript.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by lack o comments
I recently obtained a new host that supports server-side scripts and was busy re-writing my site when I slammed into a wall. It seems that functions contained in server-side scripts cannot be called from HTML tag events, ones such as "onclick".


You're confused about what is run on the client and server. Client-side events happen on the client, so they can't affect any variables on the server, unless they trigger something which causes the browser to do something to the server.

That could be a normal link with a query string (good for read / view type operations), or a javascript event handler which submits a form (better for update / submit type operations).

Quote:

The basic idea was that upon clicking a link, a function in a server-script would set a few server-variables to be used after redirecting to another page.

I don't want to pass the data in the query string,


Why not? Surely that's the best way of doing this.

Normally if it's a readonly operation, you should use a query string.

Quote:

nor use cookies along with client-scripts.


Normally you should try to avoid client scripts, unless you've made a decision that your application must require them and they will be used in particular ways in your app.

Quote:

And at the time I am completely unfamiliar with any databasing.


Irrelevant. What the server-side code does is its own business.

Quote:

I'm using ASP and JScript/javascript.


Are you using Jscript on the server-side in Active Server Pages?

I've recently been working on such a system, and there are a lot of things which behave in counter-intuitive ways, as ASP/COM has been designed with VBScript's semantics in mind, and most ASP programmers don't appreciate the differences in Jscript, especially with COM objects.

Mark

Share this post


Link to post
Share on other sites
Quote:

Quote:

Quote:
The basic idea was that upon clicking a link, a function in a server-script would set a few server-variables to be used after redirecting to another page.
I don't want to pass the data in the query string,

Why not? Surely that's the best way of doing this.

My host up until two days ago did not support sever-side scripts. Everything had to be done client-side.

I guess I didn't explain the entire situation here. Basically what I have been doing is an ad-hoc database system using client-side scripts. I recently moved to a new host that supports server-side scripting. Being unfamiliar with the stuff, it didn't immediately occur to me that what I was doing made no sense [grin]

However, I just took the easy way out and learned myself some SQL [grin]. Everything works like a charm now. Thanks anyway.

(Odd, the auto-repsond e-mail never came. I didn't know anyone answered this thread)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Google the word "AJAX" (related to javascript). That is the best way to have the client query the server for some information for a game.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!