Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8352687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:01:58+00:00 2026-06-09T09:01:58+00:00

Am following a web developer course on-line and one of the projects is to

  • 0

Am following a web developer course on-line and one of the projects is to create a fictional stock trading site.

I am using jQuery and the Validator plugin on my lookup page, but when I load it in Chrome, I keep getting Uncaught SyntaxError: Unexpected token messages, sometimes for “:”, other times its “<“.

I have looked through similar entries on the site, and tried displaying all chars and checked for matching brackets and braces (notepad++) to no avail, and have gone through the code again and again to no avail before asking for help.

The page code is below. I would really appreciate any pointers. Hopefully I haven’t missed anything silly but …

    <?
    require("../includes/common.php");
    $userID = $_SESSION['id'];

    $userQuery = $dsn->prepare("SELECT balance FROM cs75f_users WHERE uid=:uidQ");
    $userQuery->bindParam(":uidQ",$userID);
    $userQuery->execute();
    $userData = $userQuery->fetch();
    $userBalance = $userData[0];
?>

<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="javascript/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="javascript/jquery.validate.js"></script>
<style type="text/css">
* { font-family: Verdana; font-size: 96%; }
label { width: 10em; float: left; }
label.error { float: none; color: red; padding-left: .5em; vertical-align: top; }
p { clear: both; }
.submit { margin-left: 12em; }
em { font-weight: bold; padding-right: 1em; vertical-align: top; }
</style>
<script type="text/javascript"><![CDATA[

$(document).ready(function()
{
    $("#search").select();
    $("#infoDiv").slideUp();
    $("#buyDiv").slideUp();

    var searchVal = $("#searchForm").validate({
        rules:{
            search:{
                required:true,
                minlength:4,
                maxlength:4
            },
        },
        messages:{
            search:{
                required:"Please enter a valid stock symbol",
                minlength:"Please enter a valid 4 character stock symbol",
                maxlength:"Please enter a valid 4 character stock symbol"
            },
        },
        errorPlacement: function(error,element)
        {
            if (element.is(":radio"))
            {
                error.appendTo(element.parent().next().next() );
            }
            else if (element.is(":checkbox"))
            {
                error.appendTo(element.next() );
            }
            else
            {
                error.appendTo(element.parent().next() );
            }
        }
    });

    $("#searchForm").submit(function() {
        $.ajax({
            url:"getquote.php",
            data:{
                symbol:$("#search").val()
                  }
            success: function(data) {
                $("#name").html(data.name);
                $("#price").html(data.price);
                $("#high").html(data.high);
                $("#low").html(data.low);
                $("#infoDiv").slideDown();
                $("#buyDiv").slideDown();
                $("#qty").select();
                $("#hSymbol").val(data.symbol);
            }
        });
        return false;
    });

    var buyVal = $("#buyForm").validate({
        rules:{
            qty:{
                required:true,
                min:1,
                max:10000,
                digits:true
            },
        },
        messages:{
            qty:{
                required:"Please enter a valid quantity",
                min:"You must purchase at least one share",
                max:"Upper limit of 10,000 shares at one time",
                digits:"Please enter a valid number"
            },
        },
        errorPlacement:function(error,element) {
            if (element.is(":radio"))
            {
                error.appendTo(element.parent().next().next() );
            }
            else if (element.is(":checkbox"))
            {
                error.appendTo(element.next() );
            }
            else
            {
                error.appendTo(element.parent().next() );
            }
        }

    });
});

]]></script>

<title>CS75 Finance Login</title>

</head>
<body>
<div id="logo" align="center">
    <img src="images/logo.gif" border="0" alt="CS75 Finance" />
</div>
<div id="welcome" align="center">
    <h4>Welcome to CS75 Finance</h4>
    <h4>Stock Information Quote</h4>
</div>

<div id="searchDiv" align="center">
    <form id="searchForm">
        <table border="0" cellspacing="2" cellpadding="2">
            <tr>
                <td>Symbol:</td>
                <td><input type="text" id="search" size="10" /></td>
                <td></td>
                <td><input type="submit" value="Search" /></td>
            </tr>
        </table>
    </form>
</div>

<div id="infoDiv" align="center">
    <h4>Selected stock details:</h4>
    Company: <span id="name"></span><br />
    Price: $<span id="price"></span><br />
    High: $<span id="high"></span><br />
    Low: $<span id="low"></span><br />
</div>

<br />

<div id="buyDiv" align="center">
    <form id="buyForm" method="post" action="buy.php">
        <table border="0" cellspacing="2" cellpadding="2">
            <tr>
                <td colspan="5" align="center"><b>Your current balance is: $</b><? echo number_format($userBalance,2); ?></td>
            </tr>
            <tr>
                <td><input type="hidden" id="hSymbol" /></td>
                <td align="right">Qty:</td>
                <td><input type="text" id="qty" name="qty" size="10" value="1" /></td>
                <td></td>
                <td><input type="submit" value="Purchase" /></td>
            </tr>
        </table>
    </form>
</div>

<?
    $dsn = NULL;
?>

<br />
<hr width="70%">
<p align="center">CS75 Finance. Copyright 2012. All right reserved.</p>
</body>
</html>

Hope I posted correctly. Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T09:02:01+00:00Added an answer on June 9, 2026 at 9:02 am

    JS hint says, you have some errors in your code. Try to fix them and check again 🙂

    Line one is your $(document).ready

    If you like to test it yourself: http://www.jshint.com/

    Errors: Line 13: }, Extra comma.

    Line 20: }, Extra comma.

    Line 45: success: function(data) { Expected ‘}’ to match ‘{‘ from line
    40 and instead saw ‘success’.

    Line 45: success: function(data) { Expected ‘)’ and instead saw ‘:’.

    Line 45: success: function(data) { Missing semicolon.

    Line 45: success: function(data) { Missing name in function
    declaration.

    Line 66: }, Extra comma.

    Line 74: }, Extra comma.

    Line 92: }); Expected ‘(end)’ and instead saw ‘}’.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating two tables in Visual Web Developer 2010 Express using the following
I have the following problem: I run Visual Web Developer 2008. I have one
I'm a rookie web developer creating a site in C#, in VS2005 and using
I'm using the following web.config to enable tracing for my WCF service. While the
I am using IIS V5.1. Integrated windows authentication I have a following web config:
I loaded the following HTML via Ajax into a web page powered by jQuery
Im trying to use the fileupload control. Im using Visual Web Developer Express on
I'm using Visual Web Developer 2010 Express and SQL Server 2008 R2 Management Studio
Background-info: I'm using Microsoft Visual Web Developer 2010 Express. Info about my (lack of)
I'm having the following problem. I have Visual Web Developer 2010 Express and I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.