Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2004
    Posts
    2

    Unanswered: open a database in a javascript function

    Hello,
    I have this function in my ASP page:
    function calcScore() {
    var score=0;
    var numCorrect = 0;
    for (i=0 ; i<numQuestions ; i++) {
    if (answer[i] == correctAnswer[i]) {
    numCorrect = numCorrect + 1;

    score=(numCorrect/numQuestions)*10;
    }
    }

    alert('Your score is ' + score);

    if(score >=5)
    alert('you pass');
    else
    alert('you fail');
    window.location="login.asp"

    I want to open here my database and put in my table the score. Is this possible in a javascript function?

  2. #2
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    Is this client side javascript or sever side javascript? It looks like client side but I want to be sure...

  3. #3
    Join Date
    Oct 2004
    Posts
    2
    Quote Originally Posted by rokslide
    Is this client side javascript or sever side javascript? It looks like client side but I want to be sure...

    It is a client side.

  4. #4
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    so from the client machine you want to open a connection to the database on your server and let them change data..... that'd be bad m'kay....

    can you imagine the security nightmare that this would be??? what I would do is give them a link to click which would submit a http request back to the server which would update the database.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •